GCSE · Computer Science · OCR · Spec J277
Data type: Boolean
Is the sound on? Are you logged in? Is the door locked? Apps track loads of facts with just two possible answers, and one data type is built for them.
Computer Science · Programming
Which of these is a Boolean?
Pick a value, then pick its box. One question decides it: can this value only ever be true or false?
Still to sort
Boolean (0)
Holds true or false, and nothing else.
Where the line is: If the value can only ever be true or false, it's a Boolean. The moment it could be a number, a word or a third answer, it isn't.
Not a Boolean (0)
A number, some text, or anything with more than two possible values.
Where the line is: These values might be numbers or text. What they have in common is that none of them is limited to true or false.
A game app needs to remember all six values below. Decide which ones should be stored as a Boolean. Commit first, then read why.
Predict, then check
Commit to an answer before you look.
Mia's game needs to remember whether the sound is on. Instead of the Boolean value True, she stores it as the text "yes". Does the data type actually matter here?
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
Some things a program remembers can only ever be true or false. There's a data type built for exactly that.
What you need to know
- Programs work with different kinds of data: numbers, text, and true or false values, for example.
- Python uses data types so it can store and process information correctly.
- A Boolean is the data type for a value that can only be true or false.
Have a goYour phone's Do Not Disturb setting is either on or off. Could a program store it as a Boolean?
Yes. On is true, off is false.
It only ever has two states, so it maps straight onto true or false. That's all a Boolean needs.
- In Python, an example of a Boolean value is True.
- Two values, no third option: a Boolean can't hold 'maybe'.
Have a goYour mate's coding a sleepover app. 'Is Sam coming?' has three answers: yes, no, and 'depends what his mum says'. He wants a Boolean. What's the snag?
Three answers, but a Boolean holds only true or false.
It sounds like a yes-or-no question, but 'depends' is a third answer, and a Boolean has room for only true or false.
- A yes-or-no fact suits a Boolean, but the word "yes" stored as text is text, not a Boolean.
- Any setting with more than two possible values isn't a Boolean, however quick the choice feels.
Have a goA pizza app stores the crust: thin, deep or stuffed. Boolean or not?
Not a Boolean.
There are three crusts. A Boolean holds only true or false, so a three-way choice can't fit, however simple it looks.
- Choosing the correct data type is crucial.
- Get the data type wrong and your program can end up with errors.
The big picture
Programs work with different kinds of data, such as numbers, text, and true or false values, and Python uses data types to store and process information correctly. A Boolean holds true or false and nothing else; in Python, an example is True. So a fact with only two possible answers, like whether a user has logged in, suits a Boolean, while a score, a name or a reply that could be maybe does not. Choosing the correct data type is crucial, because an incorrect one can lead to errors in a program.
Key points
Worked example
Problem
A bike-hire app stores whether each bike has been returned. Asked to explain why this should be a Boolean, a student wrote: "Because it's a yes or no question." Improve the answer.
⚠ Watch out
Treating any yes-or-no style answer as a Boolean. A reply that could be yes, no or maybe has three possible values, and the word "yes" stored as text is text. A Boolean holds only true or false.
Memory hook
True or false, and that's the lot. If there's a third answer, it's not a Boolean.
Check yourself
Cover the page. Name three kinds of data a program works with and say which kind a Boolean is. Then explain, in one sentence, why choosing the correct data type matters.
Flashcards
(7)What can a Boolean hold?
Give an example of a Boolean value in Python.
Why does Python use data types?
Mia saves a true-or-false fact as the text "yes". What's the risk?
'Yes', 'no' or 'maybe': can that reply fit in a Boolean?
Is a player's score a Boolean?
Which kind of data is "yes" when it's stored in quotes?
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 OCR GCSE Computer Science topics
How this lesson was checked. This OCR GCSE Computer Science (specification J277)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 3 November 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.