# Boolean

> A value that is only ever true or false. It works like a yes or no.

**Field:** Software Development  
**Category:** Programming Concepts  
**Also known as:** bool, True or False

## Think of it like

Think of it like a light switch. It is either on or off, and never in between.

## Definition

A boolean is a value that can only be true or false. Programs use booleans to answer yes or no questions, like is the user logged in. A comparison, like 5 > 3, gives back a boolean. Ifs and loops use booleans to decide what to do next. The name comes from George Boole, who wrote the maths of true and false.

## Example

A music app keeps is_playing as a boolean. Press play and it becomes true; press pause and it becomes false.

## Example code

```python
>>> 5 > 3
True
>>> 5 == 3
False
```

Each question gives back one of only two answers.

## Why it matters

Every choice a program makes comes down to a boolean. They are what an if checks.

## Common mistake

Storing yes and no as the strings "yes" and "no". Then a typo like "Yes" breaks the check.

## Three principles

- **Two values only.** True or false, nothing else.
- **From comparisons.** Questions like a > b give a boolean.
- **Drive decisions.** Ifs and loops read them to choose.

## Related terms

- [Data Type](https://learn.benibix.com/term/development/data-type)
- [Comparison Operator](https://learn.benibix.com/term/development/comparison-operator)
- [Logical Operator](https://learn.benibix.com/term/development/logical-operator)
- [Conditional Statement](https://learn.benibix.com/term/development/conditional-statement)

## Taught in

- [Data Types in Python](https://learn.benibix.com/learn/development-concepts/data-types-in-python): Programming Basics, 6/18

---

Source: https://learn.benibix.com/term/development/boolean
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
