Nested Loops

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 may be the same type or different types of loops. Both loops may be for loops or while loops. The outer loop may be a for loop and the inner loop a while loop, or vice versa.

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy