A variable is a named location in memory that stores a value which can change during program execution. Every variable in Cambridge 9618 pseudocode must be declared before use using the DECLARE keyword.
In Cambridge 9618, assignment uses the ← operator (left-pointing arrow), not =. The = symbol is reserved for comparison (testing equality).
A constant is a named value that is set once and cannot be changed during the program. Use CONSTANT (not DECLARE) and = (not ←) to define constants:
DECLARE count : INTEGERCONSTANT PI = 3.14159price * VAT_RATE is clearer than price * 0.20The scope of a variable determines where in the program it can be accessed.
Accessible anywhere in the program — in the main body, and inside procedures/functions.
Declared inside a PROCEDURE or FUNCTION. Exists only while that block is executing. Cannot be accessed from outside.
| Operator | Meaning | Example | Result |
|---|---|---|---|
+ | Addition | 5 + 3 | 8 |
- | Subtraction | 10 - 4 | 6 |
* | Multiplication | 6 * 7 | 42 |
/ | Division (REAL result) | 7 / 2 | 3.5 |
DIV | Integer quotient | 7 DIV 2 | 3 |
MOD | Remainder | 7 MOD 2 | 1 |
& | String concatenation | "Hi" & " there" | "Hi there" |
| Operator | Meaning | Example |
|---|---|---|
= | Equal to | IF x = 5 THEN |
<> | Not equal to | WHILE count <> 0 DO |
< | Less than | IF age < 18 THEN |
> | Greater than | IF score > 100 THEN |
<= | Less than or equal | IF mark <= 40 THEN |
>= | Greater than or equal | IF grade >= 7 THEN |
x = 5 means "does x equal 5?" (comparison). Writing x ← 5 means "set x to 5" (assignment). Mixing these up is the most common error on Cambridge papers for this topic.
7 / 2 = 3.5 (REAL result). 7 DIV 2 = 3 (integer quotient, drops the remainder). 7 MOD 2 = 1 (the remainder). Checking whether a number is even: n MOD 2 = 0.
= for assignment instead of ← (Cambridge will mark this wrong)CONSTANT x ← value — CONSTANT uses =, not ←PI ← 3.0 would be an error7 / 2 = 3.5, not 38 questions · Cambridge 9618 standard
temperature of type REAL and assign it the value 36.6.[2]DECLARE total = 0CONSTANT rate ← 0.2[4]| Term | Definition |
|---|
10 questions · 10 marks · 10 minutes