TechTarget.com/whatis

https://www.techtarget.com/whatis/definition/Boolean

Boolean

By Rahul Awati

What is Boolean?

In computing, the term Boolean means a result that can only have one of two possible values: true or false. Boolean logic takes two statements or expressions and applies a logical operator to generate a Boolean value that can be either true or false. To return the result, operators like AND, OR, NOT, etc. are used.

Boolean search uses Boolean logic to connect keywords or phrases in a query. A user may use this query to find specific information in a database or during a web search. The Boolean search query combines the search terms into a machine-readable format.

Boolean logic refers to a system of logical thought developed by George Boole (1815-1864) in 1854. He was an English mathematician and philosopher as well as one of the pioneers of mathematical logic that set the stage for modern computing. His goal was to combine certain concepts and exclude certain other concepts when searching databases for information.

However, it was only in 1951 that the logic system was commercialized. This happened when Bell Labs used Boolean logic as a part of AN/FSQ-7, a massive computer used by the U.S. Air Force.

Boolean logic drives modern digital devices, such as computers and smartphones. It is used to describe electromagnetically-charged memory locations or circuit states in a computer that are either charged (1 or true) or not charged (0 or false). The computer can use logic gates and Boolean operators to obtain a result that can be used for further processing.

Common Boolean operators and web searches

Boolean logic is based on several operators known as logical operators or simply Boolean operators. These operators work on a Boolean expression or conditional statement consisting of two words or other values. The Boolean operation then generates a Boolean value that expresses a "truth value."

Boolean operators are used in computer programming, mathematical formulas and algorithms. They are often used to refine web searches. Using a Boolean operator as a conjunction between two keywords in a web search either combines or excludes them, thus generating more focused and useful results.

The three most used Boolean operators are the following:

Other Boolean operators

In addition to AND, OR and NOT, several other Boolean operators are also frequently used:

Boolean data type

The term Boolean is sometimes presented with a lower case "b": boolean. Strictly speaking, Boolean with an uppercase "B" refers to Boolean logic or Boolean algebra, while boolean refers to a data type in computer programming. The other two major data types are text and numbers.

Boolean algebra is a subset of mathematics concerned with operations on logical values, including binary variables. It underpins logical processing and decision-making in programming.

The Boolean data type values may be the following:

These values create conditions and determine how a program behaves in response to a certain event (e.g., if "X condition" is true, then do "Y").

Example 1: If a user types the correct password, then allow them to log in.

If a user types the correct password, the Boolean data type would be "true." It indicates that the object is valid or "true," which would allow the user to log in.

Example 2: If a user does not click on CAPTCHA, then display an error message.

If the user forgets to click on the CAPTCHA after typing in their email address and password, the object would be invalid. So the Boolean value would be "false."

Boolean logic in programming

In many programming languages, Boolean operators are used with conditional statements. For example, in Perl, they can be used with if statements:

if (($name eq "Gale") && ($password eq "iloveyou")) {

 print "Success\n";

}

else {

 print "Fail\n";

 die;

}

Here, the && (AND) operator will look for username "Gale" and password "iloveyou." If both values are correct, it will print "Success." If either value is incorrect, it will print "Fail."

Similarly, in JavaScript, Boolean conditionals are used in if statements and for loops.

if (boolean conditional) {

 console.log("boolean conditional resolved to true");

} else {

 console.log("boolean conditional resolved to false");

See also: fuzzy logic, proximity operator, search string, logical negation symbol, character, Karnaugh map, Claude Shannon, truth table, logical implication and Mathematical Symbols

07 Nov 2022

All Rights Reserved, Copyright 1999 - 2025, TechTarget | Read our Privacy Statement