Pseudocode IF ... THEN ... ELSE ... ENDIF
Runs the indented lines after THEN if the condition is true, otherwise runs the ELSE lines. ENDIF closes the construct and sits at the same indent as IF. ELSE is optional.
Understanding Pseudocode IF ... THEN ... ELSE ... ENDIF in IGCSE Computer Science Paper 2
What it does: There is no ELSE, so the OUTPUT line only runs when age < 18 is true. ENDIF lines up with IF to close the construct. Cambridge pseudocode uses <> (or ≠) for 'not equal to'. =! is not a valid operator. A condition compares values using = . The ← arrow is for assignment, so it cannot be used to test a value. ELSE gives the alternative path. It is optional and sits at the same indent as IF and ENDIF.
Common mistakes: The IF line is missing THEN. The condition must be followed by THEN, so it should be IF score >= 50 THEN. The comparison operator is the wrong way round. Minor should be shown when age is less than 18, so the line should be IF age < 18 THEN.
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 123–134) 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
IF THEN ELSE ENDIFFill in the Blanks
Spot the Error
Student with a class code? Join your class →