(x > y) || (x <= y)
(x > y) || !(x > y)
true
The intermediate step is obtained by extracting a not (!
) from the right side. The resulting expression is equivalent to c || !c
. (See the explanation for Exercise 2.)
It is also possible to determine that the expression always evaluates to true
without the intermediate step. The left side of the original expression checks if x
is greater than y
. The right side checks if x
is less than or equal to y
. One or the other must be true
. The expressions are combined with or (||
).
Navigation
Exercise 3 solution
Exercise 5 solution
Exercises
All solutions