Boolean
Boolean describes a value or a system with exactly two states, true and false, and the algebra of combining such values with the operations AND, OR and NOT. It is named after the English mathematician George Boole, who showed in The Mathematical Analysis of Logic (1847) and An Investigation of the Laws of Thought (1854) that logical reasoning could be written as algebra on the values 1 and 0. In programming, a boolean is the data type that holds one of those two values, and it is the result of every comparison and the input to every decision: an if statement, a while loop or a database filter is, at root, a question that must come out true or false.
Boole's algebra became the mathematics of digital hardware nearly a century after he wrote it. In 1937 Claude Shannon, then a graduate student at MIT, showed in his master's thesis, A Symbolic Analysis of Relay and Switching Circuits, that networks of on-off switches could be described and simplified with Boolean algebra, so that a circuit design could be checked like an equation. This idea underlies every logic gate in a processor. The bit, a variable with two values, is the physical carrier of a boolean, though the two are not identical: a bit is a unit of storage that can mean anything, while a boolean is a truth value with defined logical operations.
The three basic operations, and the laws relating them, are small enough to hold entirely in the mind. AND is true only when both inputs are true, OR is true when at least one input is true, and NOT flips a value. Every other function can be built from these, and from NAND alone. Useful laws include De Morgan's laws, named for Augustus De Morgan, a contemporary of Boole: NOT (A AND B) equals (NOT A) OR (NOT B), and NOT (A OR B) equals (NOT A) AND (NOT B). They are why a condition such as "not both logged in and verified" can be rewritten as "either logged out or unverified", an equivalence programmers use to simplify tangled conditions, and which circuit designers use to convert between gate types.
Languages differ in how strictly they treat booleans, and those differences cause many bugs. Python's bool is a subclass of int, so True + True equals 2; C had no boolean type at all until C99 added _Bool, using zero for false and any other value for true; JavaScript has "truthy" and "falsy" values, where 0, the empty string and null are falsy, but the string "0" and an empty array are truthy. Short-circuit evaluation means that A && B never evaluates B when A is false, a feature used to guard against null values but one that can skip side effects. A classic error is confusing logical operators (&& and ) with bitwise ones (& and |), which operate on every bit of an integer rather than on a single truth value; another is writing a comparison chain whose precedence is not what was intended.
Booleans power the filtering, searching and masking that run through everyday data work. A SQL WHERE clause is a boolean expression evaluated per row; web searches with AND, OR and NOT (or minus signs) were once the chief way to narrow results; and in NumPy and pandas a comparison such as values > 0 produces an array of booleans used as a mask to select data. SQL adds a wrinkle with NULL, where comparisons can yield a third state, unknown, so that its logic is three-valued; floating-point NaN similarly makes every ordinary comparison false. Machine learning classifiers that predict yes or no are boolean-valued, with errors counted as false positives and false negatives.
Read Boolean as the logic of two values: whatever a program decides, a circuit switches or a query selects, it ultimately reduces to combinations of true and false.