...

/

Nested Loops

Nested Loops

Learn and practice using a loop inside another loop.

Nested loop

When we use a loop inside another loop, we call them nested loops. The first loop is called the outer loop, and the second loop is called the inner loop. Nested loops can be the same type or different types of loops. Both loops can be for loops or while loops. The outer loop can be a for loop and the inner loop a while loop, or vice versa.