Boolean logic is a system of using logic in computing,
invented by George Boole in the mid 1800's.

0 = False
1 = True
(1 and 0 is just how we see it, but a computer sees it as
off and on)

AND (both values have to be true)
1 AND 1 = 1
1 AND 0 = 0
0 AND 1 = 0
0 AND 0 = 0

OR (One of both of the values has to be true)
1 OR 1 = 1
1 OR 0 = 1
0 OR 1 = 1
0 OR 0 = 0

NOT (invert)
NOT 1 = 0
NOT 0 = 1

XOR (eXclusive OR, only one value can be true)
1 XOR 1 = 0
1 XOR 0 = 1
0 XOR 1 = 1
0 XOR 0 = 0

NAND, NOR, XNOR?
By putting NOT in front of another gate you can invert the result of the original operation

E.G. NAND (NOTAND)
1 NAND 1 = 0
1 NAND 0 = 1
0 NAND 1 = 1
0 NAND 0 = 1

Boolean logic can be used in a number of ways..
The IF statement
If ( var = 1 ) ...
This is basically saying do this if the statement is true
do this. But how would you do an if where two things
must be true?
if ( (var = 1) AND (foo = 2) ) ...
XOR can even be used to swap to variables without using a
third.

Log in or registerto write something here or to contact authors.