Logic gates are based on the boolean function and carry out logical operations.
These logic gates take a number of inputs (usually 2) and return an output.
Here are some of the examples:
INPUT1 INPUT2 OUTPUT
AND
0 0 0
0 1 0
1 0 0
1 1 1
NOT (only 1 input)
0 -- 1
1 -- 0
OR
0 0 0
0 1 1
1 0 1
1 1 1
XOR
0 0 0
0 1 1
1 0 1
1 1 0
NAND
0 0 1
0 1 1
1 0 1
1 1 0
NOR
0 0 1
0 1 0
1 0 0
1 1 0
Computers use these logic gates to complete many tasks like adding numbers
or storing information (memory).
EXAMPLE
Lets say we want to run the inputs 1 and 0 into the XOR function. By doing
this, we would get an output of 1