Chapter 2

Flowcharts with Selection and Repetition

Learn the standard flowchart symbols and how a decision builds selection and repetition inside an algorithm.

Flowchart symbols

A flowchart is a diagram that shows the steps of an algorithm using standard shapes joined by arrows. Using the correct shape makes the logic easy to read.

OvalStart / Stop (terminal)
ParallelogramInput / Output
RectangleProcess
DiamondDecision

Key idea

A decision (diamond) has one way in and two ways out, labelled Yes/No (or True/False). It is what makes both selection and repetition possible.

Selection

Selection chooses between paths using a decision. For example, check whether a mark is 50 or more: if Yes, print "Pass"; if No, print "Fail". The two arrows leaving the diamond join together again afterwards, so only one of the paths actually runs. Selection is how a program makes a choice based on a condition.

Repetition

Repetition (a loop) repeats a group of steps until a condition is met. It uses a decision plus an arrow that flows back to an earlier point in the diagram. Each time round the loop the condition is tested again; when it is finally satisfied, the flow leaves the loop and continues. This lets a short flowchart describe work that is repeated many times.

Example

To output the numbers 1 to 5: set count = 1; output count; add 1 to count; a diamond asks "count > 5?". While the answer is No, the arrow loops back to output; when it becomes Yes, the flow goes to Stop.

Remember

  • Oval = start/stop, parallelogram = input/output, rectangle = process, diamond = decision.
  • A decision box always has exactly two exits.
  • Repetition uses an arrow that loops backwards.

Stuck on this topic? A verified JomKelas tutor can walk you through it.

Find a verified tutor