Grade 10 · Practical
Variables and data types
Introduction to Programming (Delphi) · about 4 min
A variable is a named storage location that holds a value of a particular type. Choosing the right type keeps data correct and memory efficient.
Key points- Declare before use: `var age : integer;` then assign with `age := 16;` (`:=` is assignment, `=` is comparison).
- Core types: integer (whole numbers), real (decimals), string (text), boolean (True/False), char (one character).
- Match the type to the data: a price is real, a quantity is integer, a name is string, a "paid?" flag is boolean.
- Constants (`const VAT = 0.15;`) name fixed values so the code reads clearly and changes in one place.
- Variable — a named, changeable storage location of a given type.
- Data type — the kind of value a variable holds and the operations allowed on it.
- Assignment — giving a variable a value with `:=`.
EXAM TIP
pick and justify a data type for each input on a form — and never store a number you'll calculate with as a string.