Boolean Logic and Logical Functions
(Page 2 of 3)
The AND and OR Functions
There are two other primary boolean functions that are widely used: the AND function and the OR function. The output of an AND function is true only if its first input and its second input and its third input (etc.) are all true. The output of an OR function is true if the first input is true or the second input is true or the third input is true (again, etc.)
Both AND and OR can have any number of inputs, with a minimum of two. Table 11 shows the truth table for the AND function, with two inputs. You can see that the output is a 1 only when both inputs are 1, and is 0 otherwise.
Like the NOT function, the AND function represents a logical operation similar to how we use the word in our every day lives. For example, at lunch time, I might suggest to a colleague "let's go out for lunch and stop at the post office".
The truth table for the OR function (again with two inputs) is shown in Table 12. Here, the output is 1 whenever a 1 appears in at least one input, not necessarily both as in the previous table.
Interestingly, unlike the AND function, the boolean OR function in fact does not have the same meaning as the way that we routinely use the word or in English. When we say or, we usually mean one or the other, but not both: you can have apple pie or chocolate cake for dessert. In the boolean OR however, the output is true as long as any of the inputs is true, even if more than one is.
A modification of OR called Exclusive-OR (abbreviated either XOR or EOR) represents the way we normally use or in the real world. Its output is only true if one input is true or the other, but not both. The truth table for XOR is as shown in Table 13. Notice the difference between this table and Table 12: the output is 0 in the case where both inputs is 1.
Home - Table Of Contents - Contact Us
The TCP/IP Guide (http://www.TCPIPGuide.com)
Version 3.0 - Version Date: September 20, 2005
© Copyright 2001-2005 Charles M. Kozierok. All Rights Reserved.
Not responsible for any loss resulting from the use of this site.