Learn
7.2.4 | FLOWCHART SYMBOLS AND CONTROL FLOW
01 | MAKE THE STEPS VISIBLE
Imagine giving someone directions through school: start at reception, walk to the stairs, and check whether the library is open. If it is open, go inside; if not, return to reception. Some instructions happen in order, but one instruction creates a choice.
A flowchart represents an algorithm using symbols connected by arrows. An algorithm is a precise sequence of steps for completing a task. The shapes tell us what kind of step is happening, and the arrows show where to go next.
The route followed through the instructions is called control flow. It can move through a sequence, choose a branch or repeat earlier steps.
Unlike a structure diagram, a flowchart shows execution rather than just grouping components. Read it by following its arrows, not by assuming every box runs from top to bottom.
02 | LEARN THE STANDARD SYMBOLS
The symbol is part of the meaning. A calculation and a decision should not be drawn in identical shapes just because both contain text.
TERMINATOR
PROCESS
INPUT / OUTPUT
DECISION
SUBROUTINE / PREDEFINED PROCESS
FLOW LINE
A terminator marks where an algorithm starts or ends. A process rectangle contains an action such as calculating or assigning a value. An input/output parallelogram receives or communicates data. A decision diamond tests a condition and has labelled outcomes.
A flow line has an arrowhead to show direction. The Cambridge syllabus also includes a subroutine symbol, also called a predefined-process symbol: a rectangle with an extra vertical line near each side. It represents a named routine whose internal steps are defined elsewhere.
Use the standard symbols when constructing an exam flowchart. The examples below use these shapes rather than decorative boxes.
03 | SEQUENCE: ONE STEP AFTER ANOTHER
Sequence means executing instructions in order. Let us build a simple program that receives two numbers and displays their sum.
The first parallelogram receives A. The second receives B. The rectangle calculates Total ← A + B. The final parallelogram outputs the calculated total.
The arrow ← means assignment: work out the expression on the right, then store the value using the name on the left. If A is 4 and B is 3, the process sets Total to 7.
Notice the difference between calculating and displaying. Total ← A + B is a process, while OUTPUT Total is output. Reversing their order would try to show the total before this calculation has produced it.
04 | SELECTION: A DECISION CHOOSES A PATH
Selection means choosing which instructions to execute according to a condition. A condition is a question whose result is true or false.
Suppose a club has capacity 3. We will focus only on checking capacity, assuming the student identifier has already passed the other required checks. BookingCount < Capacity asks whether there is room for another booking.
If the condition is true, follow the Yes branch to increase the count and display acceptance. If it is false, follow the No branch to display “Club full”. The branches then join at the end.
One execution follows one outcome of this decision. It does not display both messages. Yes/No labels explain which arrow corresponds to each condition result; True/False can express the same distinction.
05 | TRACE BOTH SIDES OF THE DECISION
A trace follows the algorithm step by step using particular starting values. You do not need a computer to do this: use the values to decide which arrows to follow.
With count 2 and capacity 3, the condition is 2 < 3, which is true. Follow Yes. The count becomes 3 and the output is “Booking accepted”.
With count 3 and capacity 3, the condition is 3 < 3, which is false. Follow No. The count stays at 3 and the output is “Club full”.
| Starting count | Condition with capacity 3 | Path | Final count and output |
|---|---|---|---|
| 2 | 2 < 3 is true | Yes | 3; Booking accepted |
| 3 | 3 < 3 is false | No | 3; Club full |
The two rows are independent starting situations. Checking both matters because a correct acceptance path does not prove the rejection path is also correct.
This simplified example changes only the count. A complete booking solution must also record accepted identifiers and carry out duplicate checking. A flowchart’s scope should be clear.
06 | ITERATION: REPEAT A GROUP OF STEPS
Iteration means repetition. A loop is a section of an algorithm that can run more than once. In a flowchart, a backwards arrow can return control to an earlier point.
Suppose we want to display 1, 2 and 3. We set a variable called Count to 1. Before each repetition, we check whether Count is less than or equal to 3. If it is, we output Count, increase it by 1 and return to the condition.
On the No branch, the algorithm ends. This is a pre-condition loop because the condition is checked before executing the repeated instructions. If Count had started at 4, the body would not run at all.
The loop body is the group of instructions being repeated: output the count and increase it. The return arrow is essential because it shows that the next step is another condition check.
07 | WALK THROUGH THE LOOP SLOWLY
At the start, Count is 1. The check 1 ≤ 3 is true, so the flowchart outputs 1. The update makes Count equal to 2, and the arrow returns to the condition.
The check 2 ≤ 3 is true, so 2 is output and Count becomes 3. The check 3 ≤ 3 is also true, so 3 is output and Count becomes 4.
Now 4 ≤ 3 is false. Follow No to End. The displayed values are 1, 2 and 3; 4 is never displayed.
| Count at check | Count ≤ 3? | Output | Count after update |
|---|---|---|---|
| 1 | True | 1 | 2 |
| 2 | True | 2 | 3 |
| 3 | True | 3 | 4 |
| 4 | False | None | No update; ends |
The final condition check is still a step in the algorithm even though the body does not execute. Do not stop tracing immediately after the last intended output: follow the arrows until the algorithm reaches End.
08 | WHAT MAKES A LOOP STOP?
The condition and the update work together. The condition asks whether another repetition should happen. The update changes a value so that the condition can eventually become false.
If we remove Count ← Count + 1, Count stays at 1. The condition remains true and the algorithm keeps displaying 1. This is an infinite loop: control continues repeating without reaching the intended exit.
If we change the condition from Count ≤ 3 to Count < 3, the algorithm outputs only 1 and 2. When Count reaches 3, the condition is already false. That is a logic error if the requirement was to display 1 through 3.
Always check initialisation, condition, repeated actions, update and exit path. A neat picture can still describe an incorrect algorithm.
09 | A LOOP CAN CHECK AFTER THE BODY
Some tasks must happen at least once. For example, a program has to ask for a menu choice before it can check whether the entered choice is valid.
In a post-condition loop, control enters the body first, then reaches the decision. A validation design could input a choice, check whether it is valid, and follow the invalid branch back to input another choice.
If the first choice is valid, the body still ran once. This differs from a pre-condition loop, whose initial check can prevent the body running at all.
The labels must match the actual question in the diamond. If it asks “Choice valid?”, Yes should leave the retry loop and No should return for another input. If you instead ask “Choice invalid?”, the branch meanings reverse.
You will practise different loop forms in the programming lessons. For now, use the position of the decision and the arrow directions to work out the behaviour.
10 | USE A NAMED ROUTINE WITHOUT DRAWING EVERY STEP
Large flowcharts can become difficult to read. A predefined process symbol can represent a routine whose detailed algorithm is shown elsewhere.
For example, a main booking flowchart might call CheckDuplicate. A separate flowchart or pseudocode description explains how that routine checks identifiers.
The extra vertical lines distinguish this symbol from an ordinary process rectangle. The label should name the routine clearly; it should not hide an undefined instruction such as “Do everything”.
A predefined process supports organising the design into smaller parts, but the main flowchart still needs to show the relevant steps and decisions. The routine’s required inputs and results must be explained where needed.
11 | DRAW A FLOWCHART THAT CAN BE FOLLOWED
Begin by understanding the task and identifying the information and decisions required. Put a clear Start at the entry point, then draw each step using the appropriate symbol.
Connect the shapes with arrowheads. Give both outcomes of a binary decision a route, and label them. If paths merge, make the meeting point clear rather than letting lines cross ambiguously.
For a loop, draw the return path to the correct step. Returning to an initialisation that resets Count to 1 every time would produce different behaviour from returning to the condition.
Keep labels precise and inside their symbols. Use an expression such as Count < Capacity rather than “Is it okay?” when the decision depends on those values.
Finally, dry-run the drawing with more than one input. The drawing is a proposed algorithm, so it needs the same careful checking as written pseudocode.
12 | PRACTISE WITH A SIMPLE DISCOUNT TASK
A shop gives a discount of 2 units when an order total is at least 10. Otherwise no discount is applied. The program receives Total and outputs the final amount.
Design the input/output parallelogram for Total, then a decision diamond containing Total ≥ 10. The Yes branch calculates Final ← Total − 2. The No branch sets Final ← Total. Both join before OUTPUT Final.
Test 8, 10 and 12. The expected outputs are 8, 8 and 10 respectively. Testing exactly 10 matters because the rule says “at least”, which includes equality.
Draw the chart in your exercise book before looking at the suggested structure in Questions. You are practising how a requirement becomes a precise condition and two different paths.
13 | EXPLAIN CONTROL FLOW CLEARLY
For a describe question, state the steps and conditions in a sensible order. For an explain question, include why the path is followed: “With Count equal to 4, the condition Count ≤ 3 is false, therefore control follows the No branch and the loop ends.”
Avoid saying that every shape runs once. Selection skips the unchosen branch, and iteration can revisit a shape several times. Read the arrows and evaluate the conditions.
Remember the distinction from the previous lesson: structure diagrams show how components are organised. Flowcharts show the steps and decision paths used while an algorithm executes.
You should now be able to identify the standard symbols, follow both sides of a decision and trace a loop through its final exit check.