AQA · GCSE · Computer Science

    Course version: 8525 · Version from Sept 2020

    Programming concepts: selection

    Selection lets a program choose between alternative paths depending on whether a condition is true or false.

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

    • Point 6 of 23

    Study notes

    From the checked teaching notes for this specification point.

    The idea

    Selection lets a program choose between alternative paths depending on whether a condition is true or false. The common forms are IF...THEN (do something only when the condition holds), IF...THEN...ELSE (choose between two paths), and ELSEIF or nested IF structures for more than two possibilities. Conditions are built from comparison operators such as equals, less than and greater than, combined with Boolean operators AND, OR and NOT. Selection differs from iteration because it runs a branch at most once per evaluation rather than repeating code. Choosing the right structure keeps a program readable and correct.

    What earns the marks

    • Selection executes different code paths depending on whether a condition evaluates to true or false.
    • IF...THEN runs a block only when the condition is true; IF...THEN...ELSE chooses between two alternative blocks.
    • ELSEIF or nested IF structures handle more than two possible outcomes.
    • Conditions use comparison operators and may combine them with AND, OR and NOT.
    • Selection differs from iteration because it does not repeat a block; it chooses a path.

    Common mistakes and how to put them right

    • Treating selection as repetition.

      Put it right: Selection chooses a path once per evaluation, whereas iteration repeats code.

    • Assuming IF...THEN without ELSE does nothing when the condition is false.

      Put it right: It simply skips the block, which is the intended behaviour.

    • Combining conditions with AND when OR is needed.

      Put it right: AND requires both parts true, while OR requires at least one true.

    Exam tips

    • State clearly which condition is tested and what happens on each outcome.
    • Use ELSEIF or nesting when a question describes three or more distinct cases.
    • Check combined conditions carefully, deciding whether AND or OR matches the described logic.

    Try the lesson

    The start of the Programming concepts: selection lesson, made from checked teaching notes for this specification point.

    Have a go first

    A program needs to display 'Pass' if a student's score is 50 or more, and 'Fail' otherwise. Which construct should be used to choose between these two outputs?

    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: selection

    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