AQA · GCSE · Computer Science

    Course version: 8525 · Version from Sept 2020

    IF GameWon THEN … Instructions here … IF Score > HighScore THEN ……

    Full specification wording

    Programming concepts: IF GameWon THEN … Instructions here … IF Score > HighScore THEN … Instructions here … ENDIF … Instructions here … ENDIF

    This pseudocode shows nested selection.

    Checked against the AQA 8525 specification (opens in a new tab) on .

    • Point 21 of 23

    Study notes

    From the checked teaching notes for this specification point.

    The idea

    This pseudocode shows nested selection. The outer IF tests GameWon; only when GameWon is true does execution enter its branch. Inside that branch, the inner IF tests whether Score is greater than HighScore. The inner block runs only if both GameWon is true and Score > HighScore is true. If GameWon is false, the inner test is never reached at all. After the inner ENDIF, further instructions still inside the outer branch run whenever GameWon was true, regardless of the score comparison. The outer ENDIF then closes the whole structure. Reading the indentation and matching each IF to its ENDIF shows the nesting. This differs from two separate IF statements, where the score test would be evaluated even when the game was not won.

    What earns the marks

    • Identifies GameWon as the outer condition tested first.
    • States that the inner IF (Score > HighScore) is only evaluated when GameWon is true.
    • Explains that the inner instructions run only when both conditions are true.
    • Recognises that instructions after the inner ENDIF but before the outer ENDIF run whenever GameWon is true.
    • Notes that if GameWon is false the inner test is skipped entirely.
    • Matches each IF with its corresponding ENDIF to confirm the nesting structure.

    Common mistakes and how to put them right

    • Saying the score test always runs.

      Put it right by noting it is inside the GameWon branch and is skipped when GameWon is false.

    • Confusing this with two independent IF statements.

      Put it right by pointing out the inner IF is physically inside the outer branch.

    • Believing the instructions after the inner ENDIF depend on the score.

      Put it right by showing they run whenever GameWon is true, whatever the score comparison result.

    Exam tips

    • Trace with sample values, for example GameWon = false, then GameWon = true with a low score, then with a high score.
    • Use the indentation and ENDIF pairing to identify which statements belong to the inner and outer branches.
    • State clearly which condition must be true before the next test can even be reached.

    Try the lesson

    The start of the Programming concepts: IF GameWon THEN … Instructions here … IF Score > HighScore THEN … Instructions here … ENDIF … Instructions here … ENDIF lesson, made from checked teaching notes for this specification point.

    Have a go first

    A program contains an IF statement placed inside another 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.

    Carry on with the full lesson

    A week of Premium from your first lesson · Then the free plan continues · No card, no charge

    Test your understanding of Programming concepts: IF GameWon THEN … Instructions here … IF Score > HighScore THEN … Instructions here … ENDIF … Instructions here … ENDIF

    Active recall beats re-reading. Take an instant quiz now to test what you’ve learned and lock it into long-term memory.

    Take topic quiz

    A week of Premium from your first lesson · Then the free plan continues · No card, no charge