Indenting statements by four spaces
Indent every statement inside a FOR, WHILE or REPEAT loop by 4 spaces. Nested loops add 4 more; wrapped continuation lines use 2. An unindented loop body is a presentation error.
Understanding Indenting statements by four spaces in IGCSE Computer Science Paper 2
What it does: The statement between WHILE and ENDWHILE has 4 spaces of indentation, while WHILE and ENDWHILE are not indented. The loop body is indented by 4 spaces, and the wrapped continuation line is indented by 2 extra spaces to show it continues the OUTPUT. The closing keyword is not part of the body. It lines up with the keyword that opened the loop. An unindented loop body is a presentation error. The student loses marks for layout even if the logic is correct.
Common mistakes: This statement is inside the FOR loop, so it must be indented by four spaces, level with INPUT Num. It is also at the left margin and uses = instead of ←. It should be ' Total ← Total + Num'. Total ← 0 comes before the loop, so it is not inside it and must not be indented. The identifier should also be in Pascal case. It should be 'Total ← 0'.
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 136–145) and word search (Modules 123–145).
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
4 spacesFill in the Blanks
Spot the Error
Student with a class code? Join your class →