AQA · GCSE · Computer Science
Course version: 8525 · Version from Sept 2020
Programming concepts: Use nested selection and nested iteration structures.
Nesting means placing one control structure inside another.
Checked against the AQA 8525 specification (opens in a new tab) on .
- Point 17 of 23
Study notes
From the checked teaching notes for this specification point.
The idea
Nesting means placing one control structure inside another. Nested selection puts an IF (or IF…ELSE) inside another IF, so a second decision is only reached when the outer condition is met; for example, checking a score is above 50, then inside that checking whether it is above 80 to award a higher grade. Nested iteration places one loop inside another, such as an outer loop over rows and an inner loop over columns to fill a grid, where the inner loop completes fully for each single pass of the outer loop. Correct indentation shows which statements belong to which block. When answering, identify the outer and inner structures, state how many times the inner block runs, and trace the order of execution.
What earns the marks
- Defines nesting as placing one control structure inside another, such as an IF inside an IF or a loop inside a loop.
- Explains that in nested selection the inner decision is only evaluated when the outer condition is true.
- Explains that in nested iteration the inner loop completes all its repetitions for each single pass of the outer loop.
- Traces execution order correctly, for example an outer loop of 3 passes with an inner loop of 4 giving 12 inner executions.
- Recognises that indentation shows which statements belong to the inner block.
Common mistakes and how to put them right
Thinking the inner loop runs only once overall.
Put it right by stating it restarts and completes for every pass of the outer loop.
Believing both branches of nested selection always run.
Put it right by explaining the inner decision is reached only if the outer condition is satisfied.
Ignoring indentation and misreading which statements are inside which block.
Put it right by matching each statement to its enclosing structure.
Exam tips
- Label the outer and inner structures before tracing any values.
- For nested loops, multiply the repetition counts to find total inner executions, then check with a short trace.
- Use indentation in any code you write so the nesting is unambiguous to the reader.
Try the lesson
The start of the Programming concepts: Use nested selection and nested iteration structures. lesson, made from checked teaching notes for this specification point.
Have a go first
A program contains an IF statement, and inside the branch that runs when the condition is true there is a second IF statement. What is this structure called?
There is more to this lesson
The full lesson goes on to check your understanding and help you earn the marks. Create a free account to carry on, with your progress saved.
A week of Premium from your first lesson · Then the free plan continues · No card, no charge
Test your understanding of Programming concepts: Use nested selection and nested iteration structures.
Active recall beats re-reading. Take an instant quiz now to test what you’ve learned and lock it into long-term memory.
A week of Premium from your first lesson · Then the free plan continues · No card, no charge