Nested loops in pseudocode
A loop placed inside another loop. The inner loop runs completely for every pass of the outer loop, so total passes = outer passes x inner passes.
Understanding Nested loops in pseudocode in IGCSE Computer Science Paper 2
What it does: Each level of nesting is indented by four spaces, so the structure of the loops can be seen at a glance. The outer loop runs 5 times and the inner loop runs 2 times on each of them, so OUTPUT runs 5 x 2 = 10 times. A nested loop needs one NEXT for every FOR. Without NEXT Column the inner loop is never closed.
Common mistakes: Assignment in pseudocode uses ←, not =. The line should be Total ← Total + 1 so the value is stored in Total on every pass of the inner loop. Count is not a loop variable here and has not been declared. The inner loop variable is Column, so the line should be OUTPUT Row * Column.
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 166–175) and word search (Modules 166–187).
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 →