Cambridge O Level Computer Science · Syllabus 2210 · Programming
Assignment
What is Assignment?
A statement that evaluates the expression on the right and stores the single resulting value in the variable on the left, replacing whatever was there.
This definition is part of the Programming chapter in Cambridge O Level Computer Science.
Assignment in context
Sequence means statements are executed one after another, in the order written, unless a control structure changes that order. INPUT <identifier> takes a value supplied by the user and stores it in the named variable. OUTPUT <value(s)> displays one or more values, separated by commas. Assignment is written <identifier> ← <value>: the expression on the right is evaluated first, and the single result is then stored in the variable on the left, replacing whatever was there. The identifier on the left must be a variable — it may be an element of a data structure such as an array — and the value must be of the same data type as the variable.
Common mistakes with Assignment
- M3. “Assignment and equality use the same symbol.” TruthAssignment is ← and stores a value; equality is = and produces TRUE or FALSE. == does not exist in this notation at all. Read it asTotal ← 5 is “Total becomes 5”; IF Total = 5 is “is Total 5?”
Questions students ask about Assignment
What is the difference between a procedure and a function?
A procedure is a named block of statements that performs a task and returns no value; it is started with the CALL statement, and control returns to the line after the call. A function performs a task and returns exactly one value of a declared data type to the point where it was called, so it is used inside an expression, such as an assignment or OUTPUT statement, and the keyword CALL must never be used with it. Both may take up to three parameters.

