Think of it like this.
If it walks like a duck,
and talks like a duck, it's a duck.
Rebecca walks like a duck, and does not talk like a duck. So, she is not a duck. Because we have said walk
and talk, both conditions must be true for the conclusion to be true. But we have one false and one true, so the conclusion is false, she is not a duck.
In other words, (x and y) is true only if x and y are both true (true and true).
If Timmy is at least 10,
or taller than 5', then he may ride the roller coaster.
(x or y)
Timmy is 10 years old, but he is not taller than 5' (true or false). He gets to ride the roller coaster because the rule states he must meet only one of the two requirements.
1 2 3
|
if (Timmy.getHeight >= 5 || Timmy.getAge() >= 10) {
Timmy.rideRollerCoaster();
}
|
not (true or false).
1 2 3
|
If (! (Timmy.getHeight >= 5 || Timmy.getAge() >= 10)) {
Timmy.wishBegToRideCoaster("please");
}
|
not (true or false)
=(not true) and (not false) |
If Timmy is not (5' or 10 yo), then he is not 5' and not 10 yo.
If Timmy is both 5' and 10 yo, x == true, and y == true, (x or y) -> (true or true) == true;