You make decisions every day. Like what movie to see. Or the fastest way home from school—bus, bike, or your own two feet. These are called OR situations. You can only select one of the available options at a time. A car or a bike, but not both.
Life is also filled with AND situations. Such as trying to get both your homework and your chores done so you can go to the movies with friends. In this case, both have to be done if you want the result (being able to go to the movies).
Remember the definition of binary? It means anything that has only two states. It could be:
|The numerals 0 and 1 in base 2|
|The conditions of on and off in a transistor|
|The answers yes and no to simple questions|
When programmers write software, they frequently use AND and OR statements to determine a result. The word AND requires both conditions to be true (in other words, a yes) for the result to happen.
The word "OR" requires either the first or the second statement to be true (a yes) for the result to happen. If you think of "yes" as a 1 and no as a 0, you can begin to see how the answers to these statements can actually be computed by a transistor. For instance, remembering that in an AND statement both conditions have to be a "yes" or a "1" for the result to be a "yes" or a "1", the following would mean you don't get to go to the movies:
Compare this to an OR statement. In this case, you would get to go to the movies if only one condition was answered with a "yes" or "1."