Follow one visitor from age to issued ticket
In this fictional worked example, a reception has three visitors, aged 12, 16 and 14, in that order. The rule is Youth when age is below 16, otherwise Standard. Start with 0 visitors completed and no tickets issued. The goal is one correctly banded ticket for each visitor.
Sequence means executing actions in order. Read the next age, choose its band, issue one ticket carrying that band, then increase completed by one. Choosing needs the age already read; issuing needs the band already chosen. Reading an age does not itself issue a ticket or increase completed.
Selection chooses which action runs from a condition: a question with a True or False result. For age 12, the test 12 < 16 is True, so choose Youth. An IF/ELSE chooses one alternative; the Standard action is skipped. Both alternatives are followed by the same Issue ticket action. A False condition does not automatically stop the whole program.
One visitor, actions in order
- Read age 12.
- Evaluate 12 < 16: True.
- Choose Youth; skip the Standard action.
- Issue one Youth ticket.
- Increase completed from 0 to 1.
Age 12 is supplied data. Completed 1 is a count. They describe different things.
Repeat the body, then include the final test
Iteration means repeating a group of actions, called the loop body. In this example, the body reads one age, chooses one band, issues one ticket and increases completed. Before entering the body, test completed < visitor count. Visitor count stays at 3; completed changes only when the update action runs.
The first three tests are 0 < 3, 1 < 3 and 2 < 3: all True. The three bodies issue Youth, Standard and Youth tickets. After the third update, completed is 3. The next test, 3 < 3, is False. It stops the loop without another age read or ticket issued.
The table records after-body snapshots. There are three body executions but four condition tests, including the final failed test. Do not invent a fourth body just because there is a fourth test. Conversely, a correct trace must not omit the test that causes the exit.
| Completed before | Age read | age < 16 | Band | Tickets after issue | Completed after update |
|---|---|---|---|---|---|
| 0 | 12 | True | Youth | 1 | 1 |
| 1 | 16 | False | Standard | 2 | 2 |
| 2 | 14 | True | Youth | 3 | 3 |
Do not treat two independent IFs as an IF/ELSE
Switch to a separate labelling example using age 12. The first independent IF writes Youth when age < 16. A second independent IF writes Wristband when age is at least 10. There is no ELSE joining them. Finish the first decision, then reach and evaluate the second.
Both conditions are True for 12, so both labels are written. These are two labels in the separate example, not two tickets in the reception run. The printed structure matters: independent IFs can both run, whereas the two alternatives of one IF/ELSE cannot both be selected on the same visit.
| Reached decision | Result for age 12 | Action |
|---|---|---|
| First IF: age < 16 | True | Write Youth |
| Second independent IF: age ≥ 10 | True | Also write Wristband |
Check entry before assuming one repetition
Start a fresh reception run with zero visitors and completed at 0. The first entry test is 0 < 0: False. No body executes, so there is no age read, band choice, issued ticket or completed-count update. There is one guard test and zero bodies.
A pre-test loop checks its condition before the body, so zero repetitions are possible. A post-test loop runs its body before the first condition check, so at least one repetition occurs. This reception example uses a pre-test loop and shared plain English; use the notation supplied by your board when tracing a printed program.
Continue with your exam board
The course combines lesson videos, interactive activities, topic questions and original exam mocks. Sign in to use the learning tools and save your progress; your account’s course access applies.
Independent learning resources. Not endorsed by AQA or OCR. These public introductions complement the full course and the official specification.