← IGCSE Computer Science Paper 2

Assignment with ← (7c)

Assignment stores the value on the right of ← in the variable on the left. The value must match the variable's data type, e.g. Counter ← Counter + 1.

Understanding Assignment with ← (7c) in IGCSE Computer Science Paper 2

What it does: Assignment gives the variable its starting value, here the number 0, ready for counting. Score is on the left because it receives the new value. The expression Score + 5 is on the right. Work out Counter + 1 on the right, then store the result in the variable on the left. A REAL variable stores a number with a decimal part. Text in quotes does not match the data type.

Common mistakes: The variable must be on the left of ←. Here the value 0 is on the left, which is not allowed. It should be Counter ← 0. Only a single variable can go on the left of ←. The expression Hours * Rate must be on the right: TotalToPay ← Hours * Rate.

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 correctly stores 0 in the variable Counter?
0 ← CounterCounter ← 0
Matches
Counter + 1 ← Counter
↓
The left side of ← must be a single variable, not an expression. The value to store must be on the right. Correct: Counter ← Counter + 1
Applying
Meanings
Term
<identifier> ← <value>
Meaning
Assignment stores the value on the right of ← in the variable on the left. The value must match the variable's data type, e.g. Counter ← Counter + 1.
Practice
Counter ← 0
Testing
Gaps
Counter 0
Check Answer
Spots
1DECLARE Counter : INTEGER
20 ← Counter

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

The 'Deer' badge — Forest Streak, 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 correctly stores 0 in the variable Counter?
A. 0 ← Counter
B. Counter ← 0 ✓
The variable goes on the left of ←. The value being stored goes on the right.
2. Which line adds 1 to Counter and stores the new value back in Counter?
A. Counter ← Counter + 1 ✓
B. Counter + 1 ← Counter
Work out Counter + 1 on the right, then store the result in the variable on the left.
3. Which line correctly calculates the amount to pay?
A. NumberOfHours * HourlyRate ← TotalToPay
B. TotalToPay ← NumberOfHours * HourlyRate ✓
The expression is on the right. The variable that receives the result, TotalToPay, is the only thing on the left.
4. True or false: in Name ← "Sam", the value "Sam" is stored in Name.
A. True ✓
B. False
The value on the right of ← is stored in the variable on the left, so Name now holds "Sam".
5. Name is declared as a STRING. Which assignment matches its data type?
A. Name ← "Sam" ✓
B. Name ← 25
The value stored must match the variable's data type. A STRING variable needs text in quotes, not a number.

Match the Pairs

Counter ← Counter + 1 → Works out Counter + 1 using the old value, then stores the result back in Counter, so it goes up by one.
TotalToPay ← NumberOfHours * HourlyRate → Multiplies the hours by the hourly rate and stores the result in TotalToPay.
Setting a counter to start at zero before a loop begins → Counter ← 0
The variable being assigned to goes on the left of the arrow only, and the value or expression goes on the right → Score ← Score + 5
Counter + 1 ← Counter → The left side of ← must be a single variable, not an expression. The value to store must be on the right. Correct: Counter ← Counter + 1
Age ← "sixteen" → Age is an INTEGER variable, so it cannot store a string. The value must match the data type. Correct: Age ← 16

Key Term

<identifier> ← <value>
Assignment stores the value on the right of ← in the variable on the left. The value must match the variable's data type, e.g. Counter ← Counter + 1.

Fill in the Blanks

1. Counter ← 0
Hint: Type the operator that stores a value in the variable on its left.
2. Counter ← Counter + 1
Hint: Type the variable whose current value is increased by one.
3. TotalToPay ← NumberOfHours * HourlyRate
Hint: Type the arithmetic operator that multiplies two values.
4. TotalToPay ← NumberOfHours * HourlyRate
Hint: Type the variable that receives the result. It goes on the left only.
5. DECLARE IsValid : BOOLEAN IsValid ← TRUE
Hint: Type the data type that matches the value being assigned.

Spot the Error

Question 1
A DECLARE Counter : INTEGER
B 0 ← Counter
C Counter ← Counter + 1
D OUTPUT Counter
Line B — The variable must be on the left of ←. Here the value 0 is on the left, which is not allowed. It should be Counter ← 0.
Question 2
A Hours ← 8
B Rate ← 12
C TotalToPay ← 0
D Hours * Rate ← TotalToPay
Line D — Only a single variable can go on the left of ←. The expression Hours * Rate must be on the right: TotalToPay ← Hours * Rate.
Question 3
A Counter = 0
B Counter ← Counter + 1
C OUTPUT Counter
Line A — In Cambridge pseudocode, = is used for comparison. Storing a value in a variable needs the assignment operator: Counter ← 0.
Question 4
A DECLARE Name : STRING
B DECLARE Age : INTEGER
C Age ← "fifteen"
D Name ← "Sam"
Line C — Age is an INTEGER, so the value assigned must be a whole number. Text in quotes is a STRING. It should be Age ← 15.
Question 5
A Price ← "4.50"
B Quantity ← 3
C Cost ← Price * Quantity
D OUTPUT Cost
Line A — The quotes make 4.50 a STRING, so it cannot be multiplied. Price holds a REAL number, so it should be Price ← 4.50.

Student with a class code? Join your class →