This is the logic that computers use to determine if a statement is true or false. There are 4 main boolean operators: AND, NOT, OR, and XOR. Below are some examples of how the 4 operators work:
x AND y returns True if both x and y are true, otherwise the expression returns False.
NOT x returns True if x is false (or null) and False if x is true.
x OR y returns True if either x or y or both are true; only if they are both false will it return False.
x XOR y returns True if either x or y are true, but not both. If x and y are both true or false, the statement will return False.
While boolean expressions are what drive the CPUs in computers, they can also be used by computer users. For example, when searching for information on the Web, many search engines accept boolean operators in the search phrases (i.e. "Yamaha AND piano NOT motorcycle"). Programmers often use boolean expressions in software development to control loops and variables as well.
Published: June 8, 2001