Error: wrong loop type
Using REPEAT when the body must sometimes not run, or WHILE when it must run at least once. REPEAT always runs once; WHILE may run zero times.
Understanding Error: wrong loop type in IGCSE Computer Science Paper 2
What it does: REPEAT ... UNTIL always runs the body once, so Password is read before it is tested. WHILE tests before the body, so if the first Mark is -1 the body is skipped and nothing is added to Total.
Common mistakes: Stock might already be 0, so the body must be able to run zero times. REPEAT always runs once and would sell an item that does not exist. Use WHILE Stock > 0 DO (and end with ENDWHILE). Pin has no value before the first INPUT, and WHILE tests before the body runs, so the INPUT may never happen. The body must run at least once, so use REPEAT (ending with UNTIL Pin = 1234).
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 232–241) and word search (Modules 232–253).
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
wrong loop typeFill in the Blanks
Spot the Error
Student with a class code? Join your class →