📁 Topic 2 · 2.2 Constructs
2.2 Sequence, selection and iteration
Edexcel 4CP0 · iGCSE Computer Science · ~11 min read
Notes
──
Video
──
Slides
──
Worksheet
──
Quiz

Sequence

Sequence is the simplest programming construct — instructions are executed one after another, in the exact order they are written. Every program has sequence as its foundation.

RECEIVE name FROM KEYBOARD
SEND "Hello, " & name TO DISPLAY
SEND "Welcome to CSZone!" TO DISPLAY

Selection

Selection allows a program to make decisions and take different paths based on a condition. The Edexcel 4CP0 pseudocode uses IF/THEN/ELSE/END IF.

IF…THEN…ELSE

IF score >= 70 THEN
SEND "Distinction" TO DISPLAY
ELSE IF score >= 50 THEN
SEND "Merit" TO DISPLAY
ELSE
SEND "Pass" TO DISPLAY
END IF

Nested Selection

Selection statements can be nested inside one another to handle multiple conditions:

IF age >= 18 THEN
IF hasTicket = TRUE THEN
SEND "Access granted" TO DISPLAY
ELSE
SEND "No ticket" TO DISPLAY
END IF
ELSE
SEND "Under 18 — no entry" TO DISPLAY
END IF

Iteration

Iteration (looping) allows a block of code to be repeated. The Edexcel 4CP0 specification includes three types of loop:

FOR Loop (count-controlled)

Used when you know exactly how many times the loop should run:

FOR count FROM 1 TO 10 DO
SEND count TO DISPLAY
END FOR

WHILE Loop (pre-condition)

Checks the condition before each iteration. May not execute at all if condition is false initially:

SET total TO 0
WHILE total < 100 DO
RECEIVE num FROM KEYBOARD
SET total TO total + num
END WHILE

REPEAT…TIMES Loop

Repeats a block a specified number of times (Edexcel-specific):

REPEAT 5 TIMES
SEND "Hello!" TO DISPLAY
END REPEAT

Choosing the Right Loop

Loop typeUse when…
FORYou know exactly how many repetitions are needed
WHILEYou check a condition first; loop may not run at all
REPEAT…TIMESYou want to repeat a fixed number of times (Edexcel variant)
📝 Exam Tip: Always close loops with the correct keyword: END FOR for FOR loops, END WHILE for WHILE loops, END REPEAT for REPEAT TIMES. Missing or incorrect closing keywords are common syntax errors.
⚠️ Common Mistakes
  • Using a FOR loop when the number of iterations depends on user input — use WHILE instead
  • Forgetting END IF after selection — every IF needs an END IF
  • Off-by-one errors in FOR loops (e.g. writing 1 TO 9 when you need 1 TO 10)
← 2.1 Testing and Debugging Topic 2 · 2.2 Constructs Next: 2.3a Data Types →
🔒
Pro Content
Subscribe to access all 47 Edexcel iGCSE lessons.
£7.99/month
or £59/year