← IGCSE Computer Science Paper 2

Assignment with ← (7a)

The ← assignment operator stores the value on its right in the variable on its left. Here 0 is stored in Counter. The value must match the variable's data type.

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

What it does: Total is on the left so it receives the value 25 from the right of the arrow. Name is a STRING variable so it must be given a string value in double quotes, not a number. The identifier on the left is the variable that gets the value. 25 is the value being stored. The right side is worked out first using the old value of Counter. The result is then stored back in Counter. ← assigns, it does not compare. Cambridge pseudocode uses ← to assign a value. == is not used for assignment in pseudocode, and it is a comparison in some languages.

Common mistakes: The variable being assigned must be on the left of the ← and the value on the right. It should be Counter ← Counter + 1. The assignment is the wrong way round. The variable goes on the left and the value on the right, so it should be Counter ← 0.

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 line correctly stores the value 0 in the variable Counter?
Counter ← 00 ← Counter
Matches
0 ← Counter
↓
The variable and value are the wrong way round. The variable must be on the left of the arrow, so this should be Counter ← 0.
Applying
Meanings
Term
Counter ← 0
Meaning
The ← assignment operator stores the value on its right in the variable on its left. Here 0 is stored in Counter. The value must match the variable's data type.
Practice
DECLARE Counter : INTEGER
Testing
Gaps
Counter 0
Check Answer
Spots
2Counter ← 0
3Counter + 1 ← Counter

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

The 'Tree Frog' badge — Leap of Logic, 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 the value 0 in the variable Counter?
A. 0 ← Counter
B. Counter ← 0 ✓
The variable always goes on the left of ←. The value being stored goes on the right.
2. In the statement Total ← 25, which part receives the value?
A. Total, on the left of the arrow ✓
B. 25, on the right of the arrow
The identifier on the left is the variable that gets the value. 25 is the value being stored.
3. What does Counter ← Counter + 1 do?
A. It increases Counter by 1 ✓
B. It checks whether Counter equals Counter + 1
The right side is worked out first using the old value of Counter. The result is then stored back in Counter. ← assigns, it does not compare.
4. Counter currently holds 4. What does it hold after Counter ← Counter + 1 runs?
A. 4
B. 5 ✓
4 + 1 is 5, and this is stored back in Counter, replacing the old value.
5. Score is declared as INTEGER. Which assignment is valid?
A. Score ← 10 ✓
B. Score ← "ten"
The value must match the variable's data type. An INTEGER variable can only store whole numbers, not a STRING.

Match the Pairs

Counter ← 0 → Stores the value 0 in the variable Counter, so it starts counting from zero
Counter ← Counter + 1 → Works out Counter + 1 using the old value, then stores the result back in Counter, adding 1 to it
The variable being assigned to is written on the left of the arrow and the value on the right → Total ← 25
The value assigned must match the data type of the variable, such as a STRING variable receiving text in quotes → Name ← "Sam"
0 ← Counter → The variable and value are the wrong way round. The variable must be on the left of the arrow, so this should be Counter ← 0.
Age ← "twelve" → Age is an INTEGER variable, but it is given a STRING value. The value must match the data type, so it should be Age ← 12.

Key Term

Counter ← 0
The ← assignment operator stores the value on its right in the variable on its left. Here 0 is stored in Counter. The value must match the variable's data type.

Fill in the Blanks

1. DECLARE Counter : INTEGER Counter ← 0
Hint: Type the assignment operator that stores a value in a variable
2. DECLARE Counter : INTEGER Counter ← 0
Hint: Type the variable name that receives the value, written on the left
3. DECLARE Counter : INTEGER Counter ← 0 Counter ← Counter + 1
Hint: Type the variable whose current value is used on the right-hand side
4. DECLARE Name : STRING Name ← "Sam"
Hint: Type the data type that matches the value being assigned
5. DECLARE Counter : INTEGER Counter ← 0 Counter ← Counter + 1
Hint: Type the arithmetic operator that increases the counter by one

Spot the Error

Question 1
A DECLARE Counter : INTEGER
B Counter ← 0
C Counter + 1 ← Counter
D OUTPUT Counter
Line C — The variable being assigned must be on the left of the ← and the value on the right. It should be Counter ← Counter + 1.
Question 2
A 0 ← Counter
B Counter ← Counter + 1
C OUTPUT Counter
Line A — The assignment is the wrong way round. The variable goes on the left and the value on the right, so it should be Counter ← 0.
Question 3
A DECLARE Name : STRING
B Name ← 5
C OUTPUT Name
Line B — Name is a STRING, so the value stored must be a string such as "Sam". A number does not match the variable's data type.
Question 4
A DECLARE Total : INTEGER
B Total ← 0
C Total ← Total + 2
D Total = Total + 5
E OUTPUT Total
Line D — In Cambridge pseudocode = is used for comparing values, not for assigning. The line should use the assignment operator: Total ← Total + 5.
Question 5
A Score := 10
B Score ← Score + 5
C OUTPUT Score
Line A — The := symbol is not Cambridge pseudocode. Assignment is written with ←, so it should be Score ← 10.

Student with a class code? Join your class →