Indentation in pseudocode
Statements inside a loop or IF are moved in by four spaces, but THEN and ELSE are moved in by only two. Nested statements keep indenting, which makes the structure easy to read.
Understanding Indentation in pseudocode in IGCSE Computer Science Paper 2
What it does: The IF sits four spaces inside the WHILE, its THEN is two more, and the OUTPUT is indented again, so the nesting is easy to see. Indentation does not change the logic of the algorithm. It makes the structure easy to read. Closing keywords such as ENDIF, ENDWHILE and NEXT line up with the statement they close.
Common mistakes: The closing keyword lines up with the FOR line at the left margin, and a FOR loop is closed with NEXT Count. ENDWHILE closes a WHILE loop. It should be 'NEXT Count'. The WHILE header ends with DO, and the loop body is then indented by four spaces underneath it. The header should be 'WHILE Score < 10 DO'.
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 17–26) and word search (Modules 1–26).
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
indentationFill in the Blanks
Spot the Error
Student with a class code? Join your class →