boolean
C2Pronunciation
UK
- /bˈuːliən/
US
- /buˈliən/
Description
- True/False
- Yes/No
- On/Off
- Binary value
- Logical condition
Imagine you're asking a question with only two possible answers: yes or no. That's the heart of what "Boolean" means! It comes from the name of mathematician George Boole, who developed an algebra dealing with these simple true/false values.
In everyday life, think about a light switch—it's either on (true) or off (false). Or consider whether a statement is correct (true) or incorrect (false). In computer science, Booleans are fundamental. They are used to make decisions in code: "If this condition is true, then do X; otherwise, do Y." A Boolean variable can only hold one of two values: `True` or `False`. You might say, "The statement 'the sky is blue' represents a Boolean value—it's True!"
"Boolean" refers to a data type in computer science and logic that represents truth values. It's named after George Boole, an English mathematician who formalized the laws of thought. At its core, a Boolean value can be in one of only two states: true or false. Think of it like a simple on/off switch—there's no in-between.
While seemingly basic, Booleans are incredibly powerful. They are the building blocks for all logical operations within computers. These operations—like AND, OR, and NOT—allow programs to make complex decisions based on specific conditions.
For example, imagine a program checking if a user is logged in and has administrator privileges. Both conditions must be true for the program to grant access. This uses a "Boolean AND" operation. If either condition is false, the result is false, and access is denied.
Booleans aren't limited to computer science; they appear in search engines, too! When you type keywords into Google, the system uses Boolean logic to find relevant results. You can even use operators like "AND," "OR," and "NOT" within your searches to refine them (e.g., "cats AND dogs NOT Persian").
So, while the word might sound technical, a Boolean simply represents a fundamental truth: something is either true or it isn't—and that simple concept powers much of the digital world around us.
Examples
- 1
Data type
This field only accepts a boolean value.
- 2
Feature flag
We added a boolean flag to control dark mode.
Domain
in computing, a flag is a simple setting that turns something on or off
- 3
Condition check
The condition must evaluate to a boolean before the code can continue.
- 4
Return value
The method returns a boolean, so check the result before you save the file.
Forms and spellings
1 form open this card.
Main spelling
- booleanadjective