A nested loop is a loop inside the body of another loop. For every single iteration of the outer loop, the inner loop runs from start to finish. Nested loops are how you work with two-dimensional data such as rows and columns, generate every pair of items, or print patterns and tables. The outer loop decides how many times the inner loop is started; the inner loop decides how much work each start does.
Keep reading for free
Create a free StudyToCert account to read the rest of this lesson: 7 more sections, 5 key terms, a real-world example, an exam tip and self-check questions. Every lesson, lab and practice test is free with an account.