OR operator
Name = "Bob" OR age > 50
This expression has only one change from the one looked at in the AND section. That change is simply we swapped the AND for a OR. This small change has dramitaclly changed what the expression means. This expression now will be true if we have people who are called Bob or older people. This means we could have -
- people over 50 who are NOT called Bob
- Young people who are called Bob
The truth table will now look like this -
name = "bob" |
age > 50 |
name = bob AND age > 50 |
True | True | True |
True | False | True |
False | True | True |
False | False | False |
Notice that the only time we get a false is when both parts are false. OR basically means that we evaluate to true if one or more of the parts evaluate to true.