← IGCSE Computer Science Paper 2

Assignment ← versus comparison =

← stores a value in a variable, so Score ← 5 saves 5 in Score. = only tests if two values are equal, as in IF Score = 5, and gives TRUE or FALSE. <> tests not equal.

Understanding Assignment ← versus comparison = in IGCSE Computer Science Paper 2

What it does: <> means not equal to. The condition is TRUE whenever Score holds any value other than 5. The arrow stores the new value on the left. Lives - 1 is worked out first, then the result is saved back in Lives. Writing = for assignment is an error in 0478 pseudocode. Use ← to store the new value. Assigning with = is a common exam error. The correct way to store 0 in Count is Count ← 0. <> is the pseudocode not-equal operator. It is used in conditions such as IF Answer <> 5 THEN. The error is using = for assignment. The correct statement is Score ← 5.

Common mistakes: Storing a value in a variable needs the assignment arrow, so it should be Score ← 0. A single = only tests whether two values are equal. An IF condition must test a value, so it needs = to compare. It should be IF Age = 18. The ← arrow would try to store 18 in Age.

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 146–155) and word search (Modules 146–165).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Which line stores the value 5 in the variable Score?
Score ← 5Score = 5
Matches
Score = 5
↓
Uses = to store a value. In 0478 pseudocode = is only for comparison, so assignment must be written Score ← 5.
Applying
Meanings
Term
Score ← 5
Meaning
← stores a value in a variable, so Score ← 5 saves 5 in Score. = only tests if two values are equal, as in IF Score = 5, and gives TRUE or FALSE. <> tests not equal.
Practice
Score ← 5
Testing
Gaps
Score 5
Check Answer
Spots
1Score = 0
2INPUT Guess

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

The 'Gazelle' badge — Tuple Sprinter, 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 line stores the value 5 in the variable Score?
A. Score ← 5 ✓
B. Score = 5
In 0478 pseudocode, ← is the assignment operator. It stores the value on the right in the variable on the left.
2. In this line, what does = do? IF Score = 5 THEN
A. Tests whether Score is equal to 5 ✓
B. Stores 5 in Score
Inside an IF condition, = is a comparison. It gives TRUE or FALSE and does not change Score.
3. Which is the correct way to write an assignment in 0478 pseudocode?
A. Total = Total + 1
B. Total ← Total + 1 ✓
Writing = for assignment is an error in 0478 pseudocode. Use ← to store the new value.
4. What result does the condition Score = 5 give when Score holds 7?
A. Score becomes 5
B. FALSE ✓
= only compares the two values. 7 is not equal to 5, so the condition gives FALSE and Score stays 7.
5. Which condition correctly tests that Score is NOT equal to 10?
A. IF Score <> 10 THEN ✓
B. IF Score ← 10 THEN
<> means not equal. ← is for assignment and can never be used to test a condition.

Match the Pairs

Score ← 5 → Stores the value 5 in the variable Score (assignment)
IF Score = 5 THEN → Tests whether Score is equal to 5, giving TRUE or FALSE
Use <> to test that two values are not equal → IF Score <> 5 THEN
Assignment changes the stored value of a variable, so Lives goes down by one → Lives ← Lives - 1
Score = 5 → Uses = to store a value. In 0478 pseudocode = is only for comparison, so assignment must be written Score ← 5.
IF Score ← 5 THEN → Uses the assignment arrow inside a condition. A condition must test equality with =, so it should be IF Score = 5 THEN.

Key Term

Score ← 5
← stores a value in a variable, so Score ← 5 saves 5 in Score. = only tests if two values are equal, as in IF Score = 5, and gives TRUE or FALSE. <> tests not equal.

Fill in the Blanks

1. Score ← 5
Hint: Type the assignment symbol that stores the value 5 in Score.
2. IF Score = 5 THEN
Hint: Type the operator that tests whether Score is equal to 5.
3. IF Lives <> 0 THEN
Hint: Type the operator that tests whether two values are not equal.
4. Count ← 0 Count ← Count + 1
Hint: Type the assignment symbol that saves the new value back into Count.
5. REPEAT INPUT Guess UNTIL Guess = Secret
Hint: Type the comparison operator that tests whether the guess equals the secret.

Spot the Error

Question 1
A Score = 0
B INPUT Guess
C IF Guess = 5
D THEN
E Score ← 10
F ENDIF
Line A — Storing a value in a variable needs the assignment arrow, so it should be Score ← 0. A single = only tests whether two values are equal.
Question 2
A DECLARE Age : INTEGER
B INPUT Age
C IF Age ← 18
D THEN
E OUTPUT "Adult"
F ENDIF
Line C — An IF condition must test a value, so it needs = to compare. It should be IF Age = 18. The ← arrow would try to store 18 in Age.
Question 3
A Attempts ← 0
B INPUT Code
C WHILE Code <> 1234 DO
D Attempts = Attempts + 1
E INPUT Code
F ENDWHILE
Line D — This line stores a new value, so it needs the assignment arrow: Attempts ← Attempts + 1. Using = only compares and does not change Attempts.
Question 4
A INPUT Pin
B Tries ← 1
C IF Pin != 1234
D THEN
E OUTPUT "Wrong PIN"
F ENDIF
Line C — In 0478 pseudocode, not equal is written <>, not !=. The line should be IF Pin <> 1234.
Question 5
A 3 ← Lives
B INPUT Hit
C IF Hit = "Y"
D THEN
E Lives ← Lives - 1
F ENDIF
Line A — The variable goes on the left of the arrow and the value on the right. It should be Lives ← 3, which stores 3 in Lives.

Student with a class code? Join your class →