Write and interpret IF / ELSE IF / ELSE / ENDIF statements in AQA pseudocode
Use nested IF statements for more complex decisions
Write a CASE OF statement as an alternative to multiple IF / ELSE IF
Choose between IF and CASE OF appropriately
IF Statement — Basic Structure
AQA Pseudocode — Selection
SIMPLE IF
IF score > 50 THEN OUTPUT 'Pass' ELSE OUTPUT 'Fail' ENDIF
WITH ELSE IF
IF score >= 70 THEN OUTPUT 'Distinction' ELSE IF score >= 50 THEN OUTPUT 'Pass' ELSE OUTPUT 'Fail' ENDIF
⚡ Rule:Every IF must have a matching ENDIF. ELSE and ELSE IF are optional.
CASE OF
Multiple-Way Branching
CASE OF day 1: OUTPUT 'Monday' 2: OUTPUT 'Tuesday' 3: OUTPUT 'Wednesday' OTHERWISE: OUTPUT 'Later' ENDCASE
WHEN TO USE CASE OF
When checking one variable against many possible values
Cleaner and easier to read than a long IF / ELSE IF chain
OTHERWISE handles any values not listed
Nested IF
IF Statements Inside IF Statements
age ← INT(USERINPUT) hasTicket ← USERINPUT IF age >= 18 THEN IF hasTicket = 'yes' THEN OUTPUT 'Entry allowed' ELSE OUTPUT 'Need a ticket' ENDIF ELSE OUTPUT 'Must be 18 or over' ENDIF
Key:Each nested IF needs its own ENDIF. Use indentation to make the structure clear.
Exam Practice
Have a go at this question
AQA-style question
Write pseudocode that reads a user's score (0–100) and outputs: • 'Grade A' if score ≥ 70 • 'Grade B' if score ≥ 55 • 'Grade C' if score ≥ 40 • 'Fail' otherwise
5 marks
score ← INT(USERINPUT) IF score >= 70 THEN OUTPUT 'Grade A' ELSE IF score >= 55 THEN OUTPUT 'Grade B' ELSE IF score >= 40 THEN OUTPUT 'Grade C' ELSE OUTPUT 'Fail' ENDIF
Key Takeaways
What to Remember
AQA syntax: IF … THEN … ELSE IF … ELSE … ENDIF
CASE OF is cleaner when checking one variable against many values
Nested IF — every inner IF needs its own ENDIF; use indentation
Conditions use = ≠ < > <= >= — not == like in Python!