Sequencing
Sequencing is the simplest construct: statements execute one after another, top to bottom, exactly once each.
BEGIN
statement 1
statement 2
statement 3
END
No conditions, no repeats. It sounds trivial, and mostly is — but two points carry marks.
Order matters when statements share data
BEGIN
a ← 5
b ← a * 2 b is 10
a ← 20
PRINT b still 10
END
b was computed from the old a. Assignment copies the value at the moment
it executes; it does not create an ongoing link. Students expect b to
"update", and it doesn't.
Assignment is not equality
count ← count + 1
Read as mathematics this says , which is false for every number. As an instruction it means: take the current value of count, add one, store the result back in count.
The arrow ← makes the direction explicit, which is why pseudocode prefers it
over =.
The classic: swapping two values
BEGIN
READ a, b
temp ← a
a ← b
b ← temp
PRINT a, b
END
The temporary variable is essential. Without it:
a ← b a is now b's value
b ← a b gets a's NEW value — the original a is lost
Both end up holding b's original value. Tracing this by hand is a standard exam question.
Desk checking a sequence
Trace with a table — one column per variable, one row per statement:
For a=3, b=7:
| Statement | a | b | temp |
|---|---|---|---|
| READ a, b | 3 | 7 | – |
| temp ← a | 3 | 7 | 3 |
| a ← b | 7 | 7 | 3 |
| b ← temp | 7 | 3 | 3 |
Output: 7 3 ✓