LESSON NOTE
|
WHY CARE? · So
why in the world are we looking at this? |
·
Boolean operators join Boolean statements
together. The common ones are AND and OR.
·
A Boolean expression is the combination
of Boolean statements (or values) joined together by Boolean operators.
Ex:
Canada’s capital is Ottawa AND Ontario’s capital is Toronto
·
AND – The overall statement is true
only if both individual statements are true.
Ex:
Earth is a planet AND Canada is a
continent. (true AND false = false)
Ravioli is pasta AND apples are fruit
(true AND true = true)
·
OR – The overall statement is true as
long as at least one statement is true.
Ex:
Oranges
are vegetables OR corn is yellow (false OR true = true)
Red
is a colour OR the Sun is a star (true OR true =
true)
·
Another operator is NOT. It only deals with a single statement and
inverses the Boolean value of that statement.
Ex:
An orange is a fruit. (True)
An orange is NOT a fruit. (False)
·
The above rules can be explained in truth
tables.
Table for AND:
Statement 1 |
Statement 2 |
Result |
True |
True |
True |
True |
False |
False |
False |
True |
False |
False |
False |
False |
Table for OR:
Statement 1 |
Statement 2 |
Result |
True |
True |
True |
True |
False |
True |
False |
True |
True |
False |
False |
False |
Table for NOT
Statement 1 |
Result |
True |
False |
False |
True |
Note:
True could be replaced by 1. False
could be replaced by 0.
In fact, in future lessons, we will be placing 0s and 1s inside truth tables instead.