What Is a Boolean?

Learn what defines a boolean data type

A Boolean is a data type in programming languages for variables that can hold only one of two possible values; true or false.

Boolean is named for the English mathematician George Boole (1815-1864) who developed mathematical Boolean logic to compare multiple Boolean values and use the results to control computer program operation.

Boolean eventually became the foundation for how computers themselves operate.

What Is an Example of a Boolean?

A Boolean variable represents 1 (true) or 0 (false) in various ways, depending on the application.

Nearly every computer language allows you to assign Boolean variables a true or false value, usually based on a Boolean comparison. Even simple VBA programs you use in Microsoft applications like Excel allow for this kind of Boolean logic.

For example:

Dim A As Boolean
Dim B As Boolean
Dim C As Boolean
A = TRUE
B = FALSE
C = A OR B

This VBA code creates Boolean variables A, B, and C. A and B are assigned values of TRUE and FALSE. The OR comparison checks if either A "OR" B are True. Since A is TRUE, the C Boolean variable is assigned a value of TRUE.

There are four Boolean operators that are used to compare values like the example above.

• A AND B: Both A and B are TRUE
• A OR B: Either A or B are TRUE
• A XOR B: Only A or B are TRUE (but not both)
• NOT B: B is NOT TRUE

What Is a Boolean in Math?

When Boolean operations are used in mathematical equations, it's called Boolean algebra. Boolean algebra uses specific symbols to represent the Boolean logic described above.

• AND: Conjunction operation using the ∧ notation
• OR: Disjunction operation using the ∨ notation
• XOR: Exclusive OR using the ⊕ notation
• NOT: Negation operation using the ¬ notation

In Boolean algebra, these notations are used to create logical expressions. In some cases, these expressions can be very complex, and include a set of logical laws within Boolean algebra.

What Are Booleans Used In?

Understanding Boolean logic is a critical skill in the field of Computer Science. It's an important part of any programming language, but also computer hardware and circuitry incorporates Boolean logic.

So where is Boolean used today?

Boolean Search

Boolean is incorporated into online search engines. This includes social media platforms and search engines.

Boolean search is a feature that lets you use Boolean operators like AND and OR to combine, limit, or filter out specific text from your search. Here are a few examples of using Boolean search in Google:

• "driving AND music": Returns results about both driving and music.
• "driving OR music": Returns results that are either about driving or music.
• "driving -music": The dash (-) is "NOT", so in this case you'll get search results about driving that exclude any results about music. (You can also exclude entire sites by typing "-site:").

Other conditions you can list in Google that aren't specifically "Boolean" in nature but are still useful include the tilde (~) for similar terms (synonyms), or double quotes (") to get results that contain the exact phrase you've typed.

Computer Hardware

Various components in the computers, laptops, and mobile devices incorporate Boolean logic into how they process instructions. All of the following utilize Boolean logic for computational processing.

• CPU: Every "core" individually carries out millions of Boolean computations per second.
• Graphics card: Video hardware contains processors using Boolean logic.
• Memory: RAM and other memory cards store information as 1's and 0's (the results of Boolean logic from various processors).
• Motherboard: The entire motherboard of a computer contains integrated circuits with microscopic transistors that incorporate Boolean logic to hold or process information.

Boolean logic lies at the heart of how computers, laptops, and mobile devices operate. Computer programs, as mentioned above, tell the processors and other circuits how to perform that Boolean logic.

Machine Automation & IoT

There are many other devices which utilize the same integrated circuits and Boolean logic as computers. For example, smart home devices like Wi-Fi cameras, smart lights, and smart locks all use Boolean logic to determine when to activate a particular thing, like turning on a light or unlocking a door.

In the manufacturing industry, devices called Programmable Logic Controllers are used by automation engineers to activate or deactivate different parts of machinery (such as robots that assemble cars), using Boolean logic. Engineers do Boolean math on input sensors to determine what parts of a machine to control.

Many people don't realize just how much of the modern world is influenced by Boolean, but it's integrated into nearly every digital device, and influences the world we live in in ways most people never realize.