← IGCSE Computer Science Paper 2

Relational operators = < <= > >= <>

Relational operators compare two values and give TRUE or FALSE: = equal, < less, <= at most, > greater, >= at least, <> not equal. Use = to compare, ← to assign.

Understanding Relational operators = < <= > >= <> in IGCSE Computer Science Paper 2

What it does: In a condition, = checks whether the two values are equal. Assigning a value uses ← instead. The ← arrow stores the value 0 in Total. It does not compare anything and gives no TRUE or FALSE result. Cambridge pseudocode uses <> for not equal. The symbol != belongs to languages such as Python. The >= operator means greater than or equal to. 16 is equal to 16, so the result is TRUE.

Common mistakes: => is not a relational operator in Cambridge pseudocode. 'Greater than or equal to' is written >=, so the line should be IF Age >= 18 THEN. Cambridge pseudocode writes 'not equal to' as <>, not !=. The line should be IF Name <> "Admin" THEN.

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 27–36) and word search (Modules 27–46).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Which symbol means 'not equal to' in Cambridge pseudocode?
!=<>
Matches
IF Mark != 40 THEN
↓
!= is not Cambridge pseudocode. Not equal is written <>, so it should be IF Mark <> 40 THEN.
Applying
Meanings
Term
= < <= > >= <>
Meaning
Relational operators compare two values and give TRUE or FALSE: = equal, < less, <= at most, > greater, >= at least, <> not equal. Use = to compare, ← to assign.
Practice
Score ← 65
Testing
Gaps
IF Age 18 THEN
Check Answer
Spots
3// 18 or over is an adult
4IF Age => 18 THEN

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

The 'Space Turtle' badge — Speed in Zero-G, 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 symbol means 'not equal to' in Cambridge pseudocode?
A. !=
B. <> ✓
Cambridge pseudocode uses <> for not equal. The symbol != belongs to languages such as Python.
2. Which line compares Age with 18 and gives TRUE or FALSE?
A. Age = 18 ✓
B. Age ← 18
= compares two values and gives a BOOLEAN result. ← assigns the value 18 to Age, so it does not compare.
3. Age is 16. What is the result of Age >= 16?
A. TRUE ✓
B. FALSE
The >= operator means greater than or equal to. 16 is equal to 16, so the result is TRUE.
4. Score is 50. What is the result of Score < 50?
A. FALSE ✓
B. TRUE
< means strictly less than. 50 is not less than 50, so the result is FALSE. Score <= 50 would be TRUE.
5. Which line stores the value 7 in the variable Count?
A. Count = 7
B. Count ← 7 ✓
← is the assignment operator and stores a value in a variable. In a condition, = compares instead.

Match the Pairs

Age <> 18 → TRUE when Age is not equal to 18, FALSE when Age is exactly 18
Score >= 50 → TRUE when Score is 50 or more, FALSE when Score is below 50
Use = to compare two values and get TRUE or FALSE, not to store a value → IF Password = "abc123" THEN
Use ← to assign a value to a variable, while = only compares values → Total ← 0
IF Mark != 40 THEN → != is not Cambridge pseudocode. Not equal is written <>, so it should be IF Mark <> 40 THEN.
IF Age ← 18 THEN → ← assigns a value and cannot compare. Use = in the condition: IF Age = 18 THEN.

Key Term

= < <= > >= <>
Relational operators compare two values and give TRUE or FALSE: = equal, < less, <= at most, > greater, >= at least, <> not equal. Use = to compare, ← to assign.

Fill in the Blanks

1. IF Age >= 18 THEN OUTPUT "Adult" ENDIF
Hint: Type the relational operator meaning greater than or equal to (at least).
2. IF Password <> "abc123" THEN OUTPUT "Wrong password" ENDIF
Hint: Type the relational operator meaning not equal to.
3. IF Choice = 1 THEN OUTPUT "You chose option 1" ENDIF
Hint: Type the operator that compares two values to test if they are equal.
4. IsTeen ← Age <= 19 OUTPUT IsTeen
Hint: Type the operator meaning less than or equal to. The comparison gives TRUE or FALSE.
5. Total ← 0 IF Total = 0 THEN OUTPUT "Empty" ENDIF
Hint: Type the symbol that assigns (stores) a value in a variable, not one that compares.

Spot the Error

Question 1
A INPUT Age
B Adult ← FALSE
C // 18 or over is an adult
D IF Age => 18 THEN
E Adult ← TRUE
F ENDIF
Line D — => is not a relational operator in Cambridge pseudocode. 'Greater than or equal to' is written >=, so the line should be IF Age >= 18 THEN.
Question 2
A IF Name != "Admin" THEN
B OUTPUT "Access limited"
C ENDIF
Line A — Cambridge pseudocode writes 'not equal to' as <>, not !=. The line should be IF Name <> "Admin" THEN.
Question 3
A WHILE Guess = Secret DO
B INPUT Guess
C ENDWHILE
Line A — The loop must keep asking while the guess is NOT the secret. Using = would stop the loop at once for a wrong guess. It should be WHILE Guess <> Secret DO.
Question 4
A INPUT Mark
B // 40 or more is a pass
C IF Mark > 40 THEN
D OUTPUT "Pass"
E ENDIF
Line C — A mark of exactly 40 should pass, but > leaves 40 out. 'At least 40' needs >=, so the line should be IF Mark >= 40 THEN.
Question 5
A INPUT Code
B IF Code ← 1234 THEN
C OUTPUT "Welcome"
D ENDIF
Line B — ← assigns a value, but an IF needs a comparison that gives TRUE or FALSE. Use = to compare: IF Code = 1234 THEN.

Student with a class code? Join your class →