← IGCSE Computer Science Paper 2

Flowchart for IF ... THEN ... ELSE

The flowchart shape for an IF. It asks a question, then the Yes path and the No path each run their own statements and rejoin before the next step.

Understanding Flowchart for IF ... THEN ... ELSE in IGCSE Computer Science Paper 2

What it does: The THEN statement (OUTPUT Pass) goes on the Yes path and the ELSE statement (OUTPUT Fail) goes on the No path, both leaving the same diamond. The condition is a question, so it goes inside a diamond. Rectangles are for processes such as assignments. Labels show which path is taken when the condition is true (Yes) and when it is false (No). The diamond holds the condition from the IF ... THEN line. Exactly two paths leave it, labelled Yes and No. In an IF ... ELSE flowchart the two paths must join back into one flow line before the next step. Fix: join both paths and continue.

Common mistakes: A decision must be drawn as a diamond, not a rectangle. A rectangle is a process box and cannot have separate Yes and No paths. It should be 'Diamond: Age >= 18?'. The start of a flowchart is drawn with a terminator (rounded) shape. A diamond is only for decisions. It should be 'Start (terminator)'.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 188–213) and word search (Modules 188–231).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Which shape do you use to draw the condition of an IF statement in a flowchart?
A process rectangleA decision diamond
Matches
Diamond: Mark >= 50 ? Two arrows leave the diamond with no labels
↓
The two flow lines are not labelled, so the reader cannot tell which path is taken when the condition is true or false
Applying
Meanings
Term
decision diamond
Meaning
The flowchart shape for an IF. It asks a question, then the Yes path and the No path each run their own statements and rejoin before the next step.
Practice
INPUT Mark
Testing
Gaps
IF Mark >= 50
Check Answer
Spots
2Input Age (parallelogram)
3Rectangle: Age >= 18?

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Penguin' badge — List Waddler, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Which shape do you use to draw the condition of an IF statement in a flowchart?
A. A decision diamond ✓
B. A process rectangle
The condition is a question, so it goes inside a diamond. Rectangles are for processes such as assignments.
2. How many paths leave a decision diamond for an IF ... THEN ... ELSE?
A. One path that is always followed
B. Two: one labelled Yes and one labelled No ✓
The diamond asks a question, so there is one path for Yes (THEN) and one for No (ELSE).
3. In a flowchart for IF ... THEN ... ELSE, what happens after the Yes path and the No path have run their statements?
A. The two paths join again before the next step ✓
B. Each path carries on separately and never meets
Whichever path is taken, the program carries on with the same next statement after ENDIF, so the paths rejoin.
4. Which statements are drawn on the No path of a flowchart for IF ... THEN ... ELSE ... ENDIF?
A. The statements from the THEN part
B. The statements from the ELSE part ✓
THEN statements go on the Yes path. ELSE statements go on the No path.
5. An IF ... THEN ... ENDIF has no ELSE. How is the No path drawn?
A. It is empty and goes straight to the rejoin point ✓
B. It is left out, so the diamond has only one exit
A diamond always has a Yes exit and a No exit. With no ELSE, the No line skips past the THEN statements and rejoins the flow.

Match the Pairs

Diamond: Score >= 50 ? → A decision diamond that asks the IF condition and has one Yes path and one No path leaving it
IF Age >= 13 THEN OUTPUT "Teen" ENDIF → An IF without ELSE: the Yes path runs OUTPUT, and the No path is empty and goes straight to the rejoin point
In IF ... THEN ... ELSE, the Yes path runs the THEN statements and the No path runs the ELSE statements → IF Mark >= 50 THEN OUTPUT "Pass" ELSE OUTPUT "Fail" ENDIF
After the Yes and No paths finish, both flow lines join again so the next statement runs whichever path was taken → IF Mark >= 50 THEN Result ← "Pass" ELSE Result ← "Fail" ENDIF OUTPUT Result
Diamond: Mark >= 50 ? Two arrows leave the diamond with no labels → The two flow lines are not labelled, so the reader cannot tell which path is taken when the condition is true or false
Yes path: OUTPUT "Pass" then END No path: OUTPUT "Fail" then END → The Yes and No paths each end separately instead of rejoining, so the next step after ENDIF is never reached

Key Term

decision diamond
The flowchart shape for an IF. It asks a question, then the Yes path and the No path each run their own statements and rejoin before the next step.

Fill in the Blanks

1. IF Mark >= 50 THEN OUTPUT "Pass" ENDIF
Hint: Type the keyword that follows the condition and starts the Yes path.
2. ELSE OUTPUT "Fail" ENDIF
Hint: Type the keyword that closes the IF, where the Yes and No paths join again.
3. IF Score >= 50 THEN OUTPUT "Pass" ENDIF
Hint: Type the relational operator for 'greater than or equal to' that the diamond tests.
4. Diamond: Age >= 18 ? Yes: OUTPUT "Adult" No: OUTPUT "Child"
Hint: Type the label on the path taken when the diamond's condition is true.
5. IF Age >= 18 THEN OUTPUT "Adult" ELSE
Hint: Type the keyword that starts the statements for the No path.

Spot the Error

Question 1
A Start (terminator)
B Input Age (parallelogram)
C Rectangle: Age >= 18?
D Yes: Output "Adult"
E No: Output "Minor"
F Stop (terminator)
Line C — A decision must be drawn as a diamond, not a rectangle. A rectangle is a process box and cannot have separate Yes and No paths. It should be 'Diamond: Age >= 18?'.
Question 2
A Start (diamond)
B Input Temp (parallelogram)
C Diamond: Temp > 30?
D Yes: Output "Hot"
E No: Output "Not hot"
Line A — The start of a flowchart is drawn with a terminator (rounded) shape. A diamond is only for decisions. It should be 'Start (terminator)'.
Question 3
A Input Score (parallelogram)
B Diamond: Score >= 40?
C No: Output "Pass"
D No: Output "Fail"
E Stop (terminator)
Line C — Both paths out of the diamond are labelled No, so there is no Yes path. The first path must be labelled Yes: 'Yes: Output "Pass"'.
Question 4
A Input Num (parallelogram)
B Diamond: Num MOD 2 <- 0
C Yes: Output "Even"
D No: Output "Odd"
E Stop (terminator)
Line B — A decision diamond asks a question that can be answered Yes or No, so it needs a comparison with = and a question mark. The arrow <- is assignment. It should be 'Diamond: Num MOD 2 = 0?'.
Question 5
A Input Pin (rectangle)
B Diamond: Pin = 1234?
C Yes: Output "Open"
D No: Output "Locked"
E Stop (terminator)
Line A — INPUT is drawn with a parallelogram. A rectangle is the process symbol. It should be 'Input Pin (parallelogram)'.

Student with a class code? Join your class →