IF score >= 70 THEN OUTPUT "Pass" ELSE OUTPUT "Fail" ENDIF
// Nested IF IF score >= 90 THEN OUTPUT "A" ELSE IF score >= 70 THEN OUTPUT "B" ELSE OUTPUT "C" ENDIF ENDIF
All IF statements must end with ENDIF in Cambridge 0478 pseudocode
CASE OF Statement
Multiple Choice Selection
CASE OF grade 'A' : OUTPUT "Excellent" 'B' : OUTPUT "Good" 'C' : OUTPUT "Pass" OTHERWISE : OUTPUT "Fail" ENDCASE
CASE OF is used when selecting from several fixed options — cleaner than many nested IFs
OTHERWISE handles any value not covered by the listed cases (like ELSE)
Iteration — Loops
FOR, WHILE, REPEAT UNTIL
// FOR — known number of repeats FOR counter ← 1 TO 10 OUTPUT counter NEXT counter
// WHILE — condition checked before WHILE answer <> "yes" DO INPUT answer ENDWHILE
// REPEAT UNTIL — condition checked after REPEAT INPUT number UNTIL number > 0
Exam Practice
Have a go at this question
Cambridge IGCSE 0478 style
Write pseudocode using a WHILE loop to keep asking the user for a password until they enter the correct one ("Secret99"). Output "Access Granted" when correct.
4 marks
INPUT password WHILE password <> "Secret99" DO OUTPUT "Incorrect. Try again." INPUT password ENDWHILE OUTPUT "Access Granted"
Key Takeaways
What to Remember
IF...THEN...ELSE...ENDIF — condition-based branching; must always close with ENDIF
CASE OF...ENDCASE — multiple fixed options; OTHERWISE handles remaining cases
FOR...NEXT: fixed count; WHILE...ENDWHILE: condition checked before; REPEAT...UNTIL: checked after
REPEAT UNTIL always runs at least once; WHILE may never run if condition is false from the start