AQA · GCSE · Computer Science
Course version: 8525 · Version from Sept 2020
Programming concepts: An example of nested iteration would be:
Nested iteration means one loop placed inside the body of another loop, so the inner loop runs completely for each single pass of the outer loop.
Checked against the AQA 8525 specification (opens in a new tab) on .
- Point 18 of 23
Study notes
From the checked teaching notes for this specification point.
The idea
Nested iteration means one loop placed inside the body of another loop, so the inner loop runs completely for each single pass of the outer loop. To judge an example, trace the structure: identify the outer loop, find the inner loop inside its body, and check that the inner loop restarts each time the outer loop repeats. For instance, an outer FOR counting rows 1 to 3 containing an inner FOR counting columns 1 to 4 produces 3 × 4 = 12 inner passes. A single loop, or two loops written one after another rather than one inside the other, is sequential iteration, not nested. When answering, look for the containment of one loop within another's body and be ready to state how many times the inner instructions execute.
What earns the marks
- Identifies that nested iteration requires one loop contained within the body of another loop.
- Distinguishes nesting (one loop inside another) from sequential loops written one after the other.
- Recognises that the inner loop completes all its repetitions for each single pass of the outer loop.
- Can state the total number of inner executions as the product of the outer and inner repetition counts, e.g. 3 × 4 = 12.
Common mistakes and how to put them right
Treating two loops written consecutively as nested.
Put it right: Nesting requires the inner loop to sit inside the outer loop's body.
Assuming the inner loop runs only once overall.
Put it right: It restarts and completes for every pass of the outer loop.
Adding the loop counts instead of multiplying.
Put it right: Total inner passes equal outer count × inner count.
Exam tips
- Underline the outer loop and the inner loop in the code before choosing an option.
- Check containment: the inner loop must appear between the outer loop's start and end.
- If counts are given, multiply outer repetitions by inner repetitions to confirm the total.
Try the lesson
The start of the Programming concepts: An example of nested iteration would be: lesson, made from checked teaching notes for this specification point.
Have a go first
Which of the following is an example of nested iteration?
There is more to this lesson
The full lesson goes on to check your understanding and help you earn the marks. Create a free account to carry on, with your progress saved.
A week of Premium from your first lesson · Then the free plan continues · No card, no charge
Test your understanding of Programming concepts: An example of nested iteration would be:
Active recall beats re-reading. Take an instant quiz now to test what you’ve learned and lock it into long-term memory.
A week of Premium from your first lesson · Then the free plan continues · No card, no charge