← IGCSE Computer Science Paper 2

Logical operator OR

Joins two conditions. The result is TRUE when at least one condition is TRUE, e.g. Day = "Sat" OR Day = "Sun". It is only FALSE when both conditions are FALSE.

Understanding Logical operator OR in IGCSE Computer Science Paper 2

What it does: If Age is 30, both Age < 5 and Age > 65 are FALSE, so the OR is FALSE. If either one is TRUE, the whole condition is TRUE. Each side of OR must be a full condition. Write Day = "Sun", not just "Sun". One TRUE condition is enough for OR. Mark > 100 is TRUE, so the result is TRUE. This is how we spot values outside a range. No number can be below 1 and above 10 at the same time, so AND is never TRUE. OR catches values at either end. Day is "Wed", so Day = "Sat" is FALSE and Day = "Sun" is FALSE. With both FALSE, OR gives FALSE.

Common mistakes: Day cannot be both "Sat" and "Sun" at once, so AND is never TRUE. OR is needed: IF Day = "Sat" OR Day = "Sun". The conditions are the wrong way round. Every number is above 0 or below 100, so every mark would be invalid. It should be IF Mark < 0 OR Mark > 100.

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 358–368) and word search (Modules 358–378).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Day ← "Sun". What is the result of: Day = "Sat" OR Day = "Sun"
FALSE, because the first condition is FALSETRUE, because the second condition is TRUE
Matches
IF Day = "Sat" OR "Sun" THEN
↓
Each side of OR must be a full condition. "Sun" on its own is not a condition. It should be Day = "Sat" OR Day = "Sun".
Applying
Meanings
Term
OR
Meaning
Joins two conditions. The result is TRUE when at least one condition is TRUE, e.g. Day = "Sat" OR Day = "Sun". It is only FALSE when both conditions are FALSE.
Practice
IF Mark < 0 OR Mark > 100
Testing
Gaps
IF Day = "Sat" Day = "Sun" THEN
Check Answer
Spots
3INPUT Day
4IF Day = "Sat" AND Day = "Sun"

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

The 'Walrus' badge — Method Master, 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. Day ← "Sun". What is the result of: Day = "Sat" OR Day = "Sun"
A. TRUE, because the second condition is TRUE ✓
B. FALSE, because the first condition is FALSE
OR is TRUE when at least one condition is TRUE. Day = "Sun" is TRUE, so the whole expression is TRUE.
2. Which statement about OR is correct?
A. It is only FALSE when both conditions are FALSE ✓
B. It is only TRUE when both conditions are TRUE
Only AND needs both conditions to be TRUE. OR needs at least one TRUE condition, so it is FALSE only when both are FALSE.
3. Which line correctly checks for a weekend day?
A. IF Day = "Sat" OR "Sun" THEN
B. IF Day = "Sat" OR Day = "Sun" THEN ✓
Each side of OR must be a full condition. Write Day = "Sun", not just "Sun".
4. Mark ← 120. What is the result of: Mark < 0 OR Mark > 100
A. TRUE, because Mark > 100 is TRUE ✓
B. FALSE, because Mark < 0 is FALSE
One TRUE condition is enough for OR. Mark > 100 is TRUE, so the result is TRUE. This is how we spot values outside a range.
5. Which condition is TRUE for a value outside the range 1 to 10?
A. Num < 1 AND Num > 10
B. Num < 1 OR Num > 10 ✓
No number can be below 1 and above 10 at the same time, so AND is never TRUE. OR catches values at either end.

Match the Pairs

Day = "Sat" OR Day = "Sun" → TRUE if the day is Saturday or Sunday (the weekend)
Mark < 0 OR Mark > 100 → TRUE if the mark is outside the valid range 0 to 100
OR is only FALSE when both conditions are FALSE → IF Age < 5 OR Age > 65 THEN
OR is still TRUE when both conditions are TRUE → x <- 10 IF x > 5 OR x > 8 THEN
IF Day = "Sat" OR "Sun" THEN → Each side of OR must be a full condition. "Sun" on its own is not a condition. It should be Day = "Sat" OR Day = "Sun".
IF Score < 0 AND Score > 100 THEN → AND is used where OR is needed. No score can be below 0 and above 100 at once, so the condition is never TRUE. It should be OR.

Key Term

OR
Joins two conditions. The result is TRUE when at least one condition is TRUE, e.g. Day = "Sat" OR Day = "Sun". It is only FALSE when both conditions are FALSE.

Fill in the Blanks

1. IF Day = "Sat" OR Day = "Sun" THEN OUTPUT "Weekend" ENDIF
Hint: Type the logical operator that makes the condition TRUE when either day matches.
2. IF Mark < 0 OR Mark > 100 THEN OUTPUT "Invalid mark" ENDIF
Hint: Type the logical operator that joins the two tests for a value outside the allowed range.
3. IF Age < 5 OR Age > 65 THEN OUTPUT "Free ticket" ENDIF
Hint: Type the relational operator that tests whether the age is above 65.
4. Wet <- TRUE Cold <- TRUE OUTPUT Wet OR Cold
Hint: Type the logical operator that still gives TRUE when both conditions are TRUE.
5. IF Letter = "a" OR Letter = "e" THEN OUTPUT "Vowel" ENDIF
Hint: Type the keyword that comes after the OR condition and before the statements to run.

Spot the Error

Question 1
A DECLARE Day : STRING
B OUTPUT "Enter the day"
C INPUT Day
D IF Day = "Sat" AND Day = "Sun"
E THEN OUTPUT "Weekend"
F ENDIF
Line D — Day cannot be both "Sat" and "Sun" at once, so AND is never TRUE. OR is needed: IF Day = "Sat" OR Day = "Sun".
Question 2
A INPUT Mark
B IF Mark > 0 OR Mark < 100
C THEN OUTPUT "Invalid"
D ENDIF
Line B — The conditions are the wrong way round. Every number is above 0 or below 100, so every mark would be invalid. It should be IF Mark < 0 OR Mark > 100.
Question 3
A Age ← 15
B Member ← TRUE
C IF Age < 16 OR Member == TRUE
D THEN OUTPUT "Cheap entry"
E ENDIF
Line C — Cambridge pseudocode compares with a single =, not ==. The line should be IF Age < 16 OR Member = TRUE. Both conditions are TRUE here and OR is still TRUE.
Question 4
A DECLARE Ans : CHAR
B INPUT Ans
C IF Ans = "Y" OR "y"
D THEN OUTPUT "Yes"
E ENDIF
Line C — OR joins two full conditions. "y" on its own is not a condition. It should be IF Ans = "Y" OR Ans = "y".
Question 5
A INPUT Temp
B OUTPUT "Checking"
C IF Temp < 5 OR Temp < 35
D THEN OUTPUT "Extreme"
E ELSE OUTPUT "Normal"
F ENDIF
Line C — The second condition should test for values above the range. Temp < 35 is TRUE for 20, so a normal temperature would be Extreme. It should be Temp > 35.

Student with a class code? Join your class →