8.1 · Lesson 1 of 7

Variables, constants and data types

Syllabus 8.1.1Syllabus 8.1.2

What this lesson covers

  • Declare and use variables and constants
  • Use integer, real, char, string and Boolean data types

Key vocabulary

Variable
A named location in memory that stores data, which can change while the program runs.
Constant
A named value that can't change while the program runs.
Identifier
The name given to a variable, constant, array or subroutine.
Declaration
Setting up a variable with an identifier and a data type, e.g. DECLARE Score : INTEGER.
Assignment
Storing a value in a variable, using ←.
Initialisation
Giving a variable its first value, e.g. Total ← 0.
INTEGER
A whole number.
REAL
A number with a decimal part.
CHAR
A single character.
STRING
Zero or more characters.
BOOLEAN
TRUE or FALSE.
Concatenation
Joining strings together.

Check your learning

  • Quick check: 4 questions
  • Key vocabulary test: 12 terms
  • Activity 1: Valid identifier? · 8 questions
  • Activity 2: What data type is it? · 8 questions
  • Activity 3: Choose the declaration · 6 questions
  • Activity 4: Variables quiz · 8 questions
Loading Bits of Bytes…