Variable, constant and data type
A named store for a value, whether it can change, and what kind of value it holds.
Please note: This page explains a word or a process in education. It is general information about the system, the law and the guidance in England — not advice about your child, your school or your exam. If a decision is going against you, get advice from one of the free services we link to before you agree to anything or miss a deadline. If you are revising, check your own exam board's specification: boards word things differently and yours is the one that marks you.
What it is
A variable is a named location holding a value that can change during execution. A constant holds a value that cannot. A data type says what kind of value it is — integer, real or float, Boolean, character, string.
Where it applies
GCSE and A Level computer science.
How it works
Data types determine what operations are allowed and how much memory is used. Adding the string "5" to the integer 5 is an error or a concatenation depending on the language, which is why casting exists.
Scope is where a variable can be seen: local to a subprogram, or global.
How to use it in your work
Name variables meaningfully. It is credited under readability, and it makes your own trace tables possible.
Use a constant where a value should not change — VAT rate, maximum size. Questions ask why, and the answer is that it prevents accidental modification and makes one edit change every use.
Be explicit about casting when converting input, which is nearly always a string.
Where to get help
Your teacher and your board's specification — the pseudocode and the required language differ between boards. Bitesize covers the concepts; the computer science song runs the topics.
Revise this with a song
These are ours. We write revision songs because a lot of people remember a tune when they cannot remember a page, and because revising out loud in the kitchen beats staring at a highlighter.
- The Computer Science Song The GCSE computer science topics, set to music.
Where to read more
Last reviewed 2026-08-28 by Fiducia Together · Next review due 2027-08-28
Please note: This page explains a word or a process in education. It is general information about the system, the law and the guidance in England — not advice about your child, your school or your exam. If a decision is going against you, get advice from one of the free services we link to before you agree to anything or miss a deadline. If you are revising, check your own exam board's specification: boards word things differently and yours is the one that marks you.
Fiducia Together