Programming
Boolean Logic
Boolean logic was developed by George Boole (18151864) and is a simple way of comparing individual bits. It uses what are called operators to determine how the bits are compared.
Think of operators as "devices" which have multiple inputs and only one output. You input various combinations of bit values (0s or 1s), and the output will be) or 1, depending on the type of operation carried out.
The 1s and 0s are sometimes referred to in the following way:
 1  High or On
 0  Low or Off
The operators used most often are AND and OR.
 The AND operation says if and only if all inputs are 1, the output will be 1. The output will be 0 if any of the inputs are 0
 The OR operation says if any input is 1, the output will be 1
Here are truth tables showing this:
AND (all 1 = 1, else 0) 

Input 1  Input 2  Output 
0  0  0 
0  1  0 
1  0  0 
1  1  1 
OR (any 1 = 1, else 0) 

Input 1  Input 2  Output 
0  0  0 
0  1  1 
1  0  1 
1  1  1 
There are two operations that have the same logic as above, but with an inverted output.
 The NAND operation says if and only if all inputs are 1, the output will be 0. The output will be 1 if any of the inputs are 0
 The NOR operation says if any input is 1, the output will be 0
NAND (all 1 = 0, else 1) 

Input 1  Input 2  Output 
0  0  1 
0  1  1 
1  0  1 
1  1  0 
NOR (any 1 = 0, else 1) 

Input 1  Input 2  Output 
0  0  1 
0  1  0 
1  0  0 
1  1  0 
Another variation on the OR operator is called the Exclusive OR or XOR. XOR says the any output will be 1 as long as the inputs are different.
XOR (different = 1, else 0) 

Input 1  Input 2  Output 
0  0  0 
0  1  1 
1  0  1 
1  1  0 
The inverse of the XOR operator is the NXOR and it negates the result of the XOR operator.
NXOR (different = 0, else 1) 

Input 1  Input 2  Output 
0  0  1 
0  1  0 
1  0  0 
1  1  1 
Another operator is the inverter or NOT operation. The NOT operator says that the output will be opposite in state to the input. This operator is different to the others because it has only one input and one output.
NOT (inverter) 

Input  Output 
0  1 
1  0 
Note that the NOT can change an AND to a NAND, an OR to a
NOR and an XOR to a NXOR
if connected to their outputs by changing 1s to 0s and 0s to 1s.
Logical Operator 
Abbreviation 
Symbol 
And  AND  & 
Or  OR   
Exclusive Or  XOR  ^ 
Inversion  NOT  ~ 