Topic 8 · Programming · 8.5

Sequence Explained Simply

Sequence means running instructions once, in the exact order they are written. Change the order, and you may change the result.

Invitation

Why does order matter in a program?

A computer follows instructions from top to bottom. It does not rearrange them or guess what should happen first.

Sequence is a programming construct where instructions run once, in the order they are written.

First line first. Second line second. Each instruction happens once.
Figure 1
A simple sequence
1. Ask for a name
2. Store the name
3. Display a greeting
Big Idea

Programs often begin with a straight path

In a sequence, there are no choices and no repeated instructions. The program simply moves from one statement to the next.

Input, calculations, assignment and output can all be arranged as one sequence.

Sequence is the simplest program flow: start at the top and work down.
Figure 2
One clear route
INPUT
PROCESS
OUTPUT
FutureLogic Bridge

Sequence is like a factory assembly line

Imagine a product moving along an assembly line. First one part is fitted, then another, and finally the product is checked.

If the checking stage happened before the product was built, the process would make no sense. A program is the same: each instruction must happen at the correct stage.

On an assembly line, each station has its turn. In a sequence, each instruction has its turn.
Figure 3
The assembly-line bridge
Collect data
Calculate result
Show result
Worked Example

Calculate a user's age next year

The program must first collect the age, then calculate the new value, and only then display it.

PseudocodeSequence
OUTPUT("Enter your age")
INPUT Age
AgeNextYear ← Age + 1
OUTPUT("Next year you will be ", AgeNextYear)

Follow the order

If the user enters 14, the program calculates 14 + 1.

Output: Next year you will be 15
Why Order Matters

The same instructions can give a different result

Correct orderInput → calculate → output.
Wrong orderOutput before calculating.
ResultThe displayed value may be missing or incorrect.
A correct instruction in the wrong place can still make the program wrong.
Exam Tip

Use the words “once” and “in order”

When defining sequence, include both parts of the definition.

Strong answer: “Sequence is a programming construct where instructions are executed once, in the order they are written.”

Do not only say that the instructions happen “one after another”; make clear that each statement runs once.

Common Mistake

“The computer will work out the correct order.”

The computer does not rearrange the program. It follows the statements exactly as written.

Incorrect: “The computer decides which instruction should happen first.”
Correct: “The programmer places the instructions in the required order, and the computer follows them from top to bottom.”
Summary

The straight-line construct

Executed onceEach statement runs one time.
Written orderTop statements run before lower statements.
No choiceThere is no decision between different routes.
No repetitionThere is no loop.
Useful for IPOInput, process and output can form a sequence.
Order mattersChanging the order can change the result.