A loop inside a loop
A REPEAT placed inside another REPEAT. The inner loop runs all its repeats again for every repeat of the outer loop, so an outer 3 and an inner 4 gives 12 inner passes.
Understanding A loop inside a loop in ACARA Digital Technologies Years 7–8
What it does: The inner loop is indented one level further, and the two END REPEAT lines close the inner loop first and then the outer loop. For each of the 4 rows, the inner loop checks 3 seats, so there are 4 x 3 = 12 checks in total. A nested loop sits inside the body of another loop. Two loops one after the other are just in sequence. Indenting each loop body shows which steps belong to which loop. Pseudocode with everything at the left edge is hard to read. Multiply the outer count by the inner count: 5 x 2 = 10 inner passes.
Common mistakes: The outer loop must say how many repeats it makes using the word TIMES. It should be 'REPEAT 3 TIMES'. The inner loop has the words in the wrong order. A counted loop is written REPEAT then the number then TIMES, so it should be ' REPEAT 4 TIMES'.
Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 365–411) and word search (Modules 331–411).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
nested loopFill in the Blanks
Spot the Error
Student with a class code? Join your class →