GCSE · Computer Science · AQA · Spec 8525
Integer data type
A score of 1500, a price of 1.25, a lift on floor -2. All numbers, so why do they get different data types?
Computer Science · Data types
Integer or not? You decide
Would you store this value as an integer? Pick a value, commit to a pile, then read why.
Still to sort
Store as an integer (0)
Whole numbers — positive, negative or zero — that you count or calculate with.
Where the line is: The value must be a whole number that you count or calculate with.
Needs a different data type (0)
Values with a fractional part, or values that aren't numbers at all.
Where the line is: A fractional part rules integer out. So does a value that isn't a number.
Six values a program might need to store. Some are traps. Sort each one before you read why.
AQA exam questions use the general names integer, real, Boolean, character and string. Write integer, even if the language you use calls it int.
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
Not every number is one — and picking the wrong type can break a program.
What you need to know
- A data type decides what kind of value a program can store, and what it can do with that value.
- An integer is a whole number: positive, negative or zero. No fractional part allowed.
Have a goQuick one: which of these is NOT an integer — 0, -12, 7.5 or 300?
7.5
It has a fractional part (.5). 0 and -12 are the ones that tempt people, but zero and negative whole numbers are integers too.
- Pick integer for whole-number values you count or calculate with, such as scores, quantities and floor numbers.
- A Boolean has just two possible values: True or False.
Have a goYour mate Sam counts the goals the school team scored last match. Integer or real, and why?
Integer — goals are counted, so the value is always a whole number.
Nobody scores half a goal. A count is a whole number, and counting is exactly what the integer type is for.
- Got a fractional part, like a price of 1.25? That needs the real type, often called float.
- Common data types include integer, real (float), string and Boolean.
- Languages have their own names for types. Python says int; the general name is integer.
- Using an incorrect data type can cause errors: the program may stop, or run and quietly give a wrong answer.
- A string holds text, such as a name.
Have a goA program stores a drink's price, 1.25, as an integer. What goes wrong?
An integer can't hold the .25 — the price needs the real type.
1.25 has a fractional part, and an integer can only hold whole numbers. Using an incorrect data type can cause errors.
The big picture
Every value in a program has a data type, and the type decides what kind of value it is and what the program can do with it. Integer is the type for whole numbers — positive, negative or zero — that you count or calculate with. Values with a fractional part need a real. Pick the wrong type and the program can go wrong with errors.
Key points
Worked example
Problem
A cinema records how many people watched a film on each of 5 nights: 120, 135, 128, 141 and 130. The program stores each night's attendance and also the mean attendance. Choose a data type for each night's attendance and for the mean.
⚠ Watch out
Choosing integer just because a value looks like a number. A price such as 1.25 is a number, but it has a fractional part, and an integer can only hold whole numbers. It needs the real type.
Memory hook
Whole, and worth counting or calculating with? Integer. Got a point in it? Real, not integer.
Check yourself
Which of these values could be stored as an integer: 17, -40, 0 and 2.5? For each one you rule out, say which property rules it out.
Flashcards
(10)What does a data type decide?
What is an integer?
Are -5 and 0 integers?
When should you choose the integer type?
Which type holds only True or False?
Which type holds a value like 2.75?
Name four common data types.
Python calls it int. What is the general name?
Which type holds text, such as a name?
What can go wrong if a value has the wrong data type?
Tap any card to flip it, or use Study as deck to go through them one at a time. In the full lesson these run as a spaced-repetition deck — you rate each card Hard, Good or Easy and the tricky ones keep coming back until they stick.
Learning with Lightbulb is opening soon
You can use this lesson now. Join the waitlist and we'll let you know when the full Lightbulb experience is ready.
Keep me postedMore AQA GCSE Computer Science topics
- Equal to (relational operator)
- Greater than (relational operator)
- Greater than or equal to (relational operator)
- Identifying and categorising errors
- Indefinite (condition-controlled) iteration
- Integer / real to string conversion
- Integer division and remainder
- Iteration
- Keyboard input
- Less than (relational operator)
- Less than or equal to (relational operator)
- Local variables
How this lesson was checked. This AQA GCSE Computer Science (specification 8525)lesson was published through Lightbulb Learning's human-designed editorial process — the educational standards, accuracy rules and publication checks it must pass were authored and approved by Philip Halpin. It passed subject-specific assessment, automated educational checks and technical publication verification before going live (publication checks completed 28 October 2026). Published pages are monitored, human spot-checking is ongoing across the lesson library, and anything found wrong is corrected or withdrawn. How our lessons are made and checked. Spotted a mistake? Email hello@lightbulblearning.co and we'll review it.