Selection and Iteration
Aligned to the AQA 8525 specification
- Topic
- Programming
- Level
- Intermediate
- Reading time
- 8 min
- Published
- 8 June 2026
- Updated
- 1 July 2026
On this page
Key takeaways
- Selection (IF...THEN...ELSE) lets a program choose between execution paths based on whether a condition is TRUE or FALSE; in AQA pseudocode every IF must end with ENDIF and the ELSE clause is optional.
- Definite (count-controlled) iteration with FOR repeats a block a fixed number of times; in AQA pseudocode FOR i ← 1 TO 5 includes both endpoints, unlike Python's range(1, 6) which excludes the upper bound.
- A WHILE loop checks its condition before the body and can run zero times, while REPEAT...UNTIL checks after the body and always runs at least once, making it the classic choice for input validation.
- WHILE continues while its condition is TRUE and stops when it becomes FALSE; REPEAT...UNTIL continues while FALSE and stops when the condition becomes TRUE.
- Nested iteration runs the inner loop fully for each single iteration of the outer loop, so a loop over an n × m grid executes the body n × m times.
Worth saving these ideas?
Turn what you've read into instant revision cards. Free to get started.
Key terms
- Selection
- A construct that allows a program to choose between different execution paths based on whether a condition is TRUE or FALSE.
- Nested selection
- Placing one IF statement inside another to handle more than two possible outcomes, used when conditions are mutually exclusive.
- Definite iteration
- Count-controlled iteration that repeats a block of code a fixed, predetermined number of times, written with a FOR loop.
- Indefinite iteration
- Condition-controlled iteration that repeats a block as long as a condition remains TRUE, used when the number of repetitions is unknown in advance.
- REPEAT...UNTIL
- A form of indefinite iteration where the body runs first and the condition is checked after, guaranteeing the body runs at least once.
- Nested iteration
- Placing one loop inside another so the inner loop completes all its iterations for each single iteration of the outer loop.
- Trace table
- A table that tracks the value of every variable that changes through each iteration of an algorithm, one row per execution.
- Accumulator
- A variable initialised before a loop (e.g. total ← 0) that builds up a running total by adding inside the loop.
Frequently asked questions
A WHILE loop checks its condition before the body runs, so it can execute zero times, and continues while the condition is TRUE. REPEAT...UNTIL checks the condition after the body, so it always runs at least once, and continues while the condition is FALSE.
Use a FOR loop when the number of repetitions is known before the loop starts, such as counting from 1 to 100. Use WHILE or REPEAT...UNTIL when the loop must continue until a condition changes and the number of repetitions is unknown in advance.
No, AQA pseudocode has no ELIF keyword. To handle more than two outcomes you use nested IF...ELSE...ENDIF statements, where each inner IF is only reached once the outer condition has been resolved.
Generate revision on any topic you study
Type any topic you're studying and Aicademy generates a complete lesson, quiz, and flashcard set, personalised to your level.
Lessons on anything
Structured, level-matched lessons on any topic you study
Practice quizzes
Find out what you actually know before the exam does
Flashcard sets
Lock in key concepts with instant revision cards
Ask Aica
Stuck on something? Get a clear explanation, any time
Variables, Constants and Data Types
Arrays and Records
Related lessons
9 min
9 min
8 min