Decisions in algorithms

About this lesson: Decisions in algorithms

In short

Algorithms often need to choose. In a flowchart, a diamond holds a condition: a question whose answer is TRUE or FALSE. Set the temperature, run the flowchart and follow the path.

Decisions in algorithms

What you'll explore

Flowcharts: The diamond decides
Algorithms often need to choose. In a flowchart, a diamond holds a condition: a question whose answer is TRUE or FALSE.
IF … THEN … ELSE: Only one branch runs
In pseudocode, IF checks the condition. If it is TRUE, the THEN part runs; if FALSE, the ELSE part runs. Never both.
Several outcomes: Checks run in order
With ELSE IF, the computer checks each condition in order and stops at the first TRUE one. Change the race time and see which medal is chosen.
Check yourself: Which branch?
IF age >= 13 THEN OUTPUT "Join the club" ELSE OUTPUT "Wait a little" ENDIF

Also in this lesson

  • Common mix-ups
  • Comparison operators
  • Flowchart shapes
  • Decision tree

Words to know

selection
Choosing which steps run, depending on a condition.
condition
A question with the answer TRUE or FALSE.
branch
One of the paths an algorithm can take.
comparison operator
A symbol such as >, <, = that compares two values.
flowchart
A diagram of an algorithm using shapes and arrows.

Sources

  • BBC Bitesize KS3 Computing: Selection

An interactive lesson with a live experiment: move the sliders, press the buttons and answer quick questions. 4 short steps and a 6-question quiz. Part of the Family plan. Written and checked by Shalo Lab. Last updated 11 November 2026.

← Tracing and predicting · Linear search →

All lessons in Term 1 · Computing · Age 12