There are three major functions in Digital Electronics. These functions are used to make more complicated circuits, so an understanding of how these building blocks work is key to understanding how circuits work.
The "AND" function requires that multiple inputs are all true for the output to be true. For example, if you turn your car's ignition key, and step on the gas, then your car will start. Simply turning the key or stepping on the gas isn't enough, both must be done to get the correct output. Likewise, all the inputs into an AND gate must be true for the output to be true.
The "OR" function requires any input to be true for the output to be true. For example, you can enter your home through either the back door or front door. Once you enter either one, you are inside your home. Likewise, at least one of the inputs into an OR gate must be true for the output to be true. If more then one input is true, the output is still true, since the minimum requirement is one.
The "INVERTER" function (also known as the "NOT") simply changes the condition. If it was true it becomes false, and if it was false it becomes true. For example, it is never day and night at the same time. If it is day, it is not night. Likewise, an INVERTER gate will logically change the input. For the output to be true, the input must be false.
In digital electronics, a false condition is 0 volts (called VSS), while a true condition is the applied voltage (called VCC or VDD). Since the applied voltage can range from under 3 volts to 5 volts, the true condition is normally simply called a logical 1, and the false condition is called a logical 0.
Using this information, it is possible to create what is called a "truth table." A truth table lists each possible input combination, and the resulting output for each combination. While the AND and the OR functions can each have two or more inputs, the truth table given here will assume two inputs.
AND OR
INV
#1 #2 O #1 #2 O I O
------- ------- ---
0 0 0 0 0 0
0 1
0 1 0 0 1 1
1 0
1 0 0 1 0 1
1 1 1 1 1 1
To read this table, read across. For example, look at the third line down. If input #1 is a logical 1 while input #2 is a logical 0, the output of an AND gate is a logical 0. On the other hand, the same inputs into an OR gate will generate a logical 1 output. Remember that for an AND gate all inputs must be true (input #1 AND input #2) to get a true output. However, for an OR gate only one must be true (input #1 OR input #2) to get a true output.