Boolean is a data type that has been around for quite some time, and it exists in almost every programming languages. In programming, Boolean is a subset of algebra which accepts either true or false value.
The idea behind Boolean expression is to assign values to variables, and then use these values in logical statements. A Boolean is typically either true or false, but it can also have one of many other Boolean values such as ON/OFF, YES/NO.
Boolean expressions use comparison operators to compare values and tell if they are true or false. There are 4 operators: AND, NOT, OR, and XOR.
a AND b: return True if both are True; return false if one value is False.
NOT a: return True if a is False or Null, and vice versa.
a OR b: return True if one value is True; return False if both values are False.
a XOR b: return True if there is only one True value; return False if both values are True or both are False.
Computers use only binary as opposed to numbers. Computer logic can often be expressed in boolean terms because of this. A statement in programming is true if it returns a 1 when evaluated, while false statements return 0.
In programming, Boolean data is used for comparisons and decisions that require only two possible outcomes. However, it requires more than 1 simple true/false statement for lots of calculations. Therefore, we can link them together to make more complicated statements.