nesting

Putting one control statement inside another, such as an if inside a for loop, with each level indented further.

In more detail

The inner block runs as part of the outer one: an if inside a loop is tested on every pass. Deep nesting gets hard to read, which is a hint to move the inner part into a function. Data can nest too: lists of lists, dictionaries of lists.

Related terms

Taught in

References

Certification courses