Boolean
Also known as: bool, true/false, logical value
A data type representing a logical value that can only be true or false—nothing else. Booleans drive all program logic — conditionals, loops, and comparisons all produce or consume boolean values.
💡 Intuition
A boolean is a yes/no answer. Is the user logged in? True or false. Is the number positive? True or false.
Core Idea
Booleans are the language of decisions. Every if-statement evaluates a boolean condition.
🔬 Example
🎯 Why It Matters
Booleans drive all program logic — conditionals, loops, and comparisons all produce or consume boolean values.
⚠️ Common Confusion
0, empty string, None/null, and empty lists are often 'falsy' — they act like False in conditions even though they're not boolean.
Related Concepts
Prerequisites
Next Steps
How Boolean Connects to Other Ideas
To understand boolean, you should first be comfortable with assignment and data types. Once you have a solid grasp of boolean, you can move on to boolean logic and selection.
Go Deeper
Frequently Asked Questions
What is Boolean in CS Thinking?
A data type representing a logical value that can only be true or false—nothing else.
Why is Boolean important?
Booleans drive all program logic — conditionals, loops, and comparisons all produce or consume boolean values.
What do students usually get wrong about Boolean?
0, empty string, None/null, and empty lists are often 'falsy' — they act like False in conditions even though they're not boolean.
What should I learn before Boolean?
Before studying Boolean, you should understand: assignment, data types.