# Boolean Values

Roger Sanchez
Greenhorn
Posts: 16
A couple of other questions in preparation for an exam:
( ( x || ! ( y && z ) ) && ! ( y || z) )

( ( ! x && ( y || z ) ) || ( ! y || z))

Thanks again,
Roger

Paul Zill
Greenhorn
Posts: 28

not sure what the question is.
did you forget the values for x, y, & z?

Jaunty John
Greenhorn
Posts: 21
These will always resolve false if NOT true

Paul Zill
Greenhorn
Posts: 28
Originally posted by Jaunty John:
These will always resolve false if NOT true

if what not true
if:
boolean x = true;
boolean y = false;
boolean z = true;
than the first example would be true.
and second false.
if:
boolean x = false;
boolean y = false;
boolean z = true;
the the first is false and the second is true.

Roger Sanchez
Greenhorn
Posts: 16
I forgot to put the variable values:
x = false, y = true, z = false
( ( x || ! ( y && z ) ) && ! ( y || z) )

x = false, y = true, z = false
( ( ! x && ( y || z ) ) || ( ! y || z))
Thanks again

Joe Pluta
Ranch Hand
Posts: 1376
They might be trying to simplify the equation.
For example, take this one:
( ( x || ! ( y && z ) ) && ! ( y || z) )
If either y or z is true, this statement is false (because the right side of the *AND is false). So, plug false values for y and z into the left expression, getting (x || true), which removes x from the equation.
The whole thing factors downs to (!y && !z).
Similarly, after some careful manipulation, the second statement is (!x || !y || z).
Don't believe me? You could always try a truth table <grin>.
Joe

Roger Sanchez
Greenhorn
Posts: 16
Thanks for the quick reply. So, to check my understanding, both statements are false?

Joe Pluta
Ranch Hand
Posts: 1376
Nope. First is false, second is true. Quick runthrough:
x = false, y = true, z = false
( ( x || ! ( y && z ) ) && ! ( y || z) )
( ( F || ! ( T && F ) ) && ! ( T || F ) )
( ( F || ! ( F ) ) && ! ( T ) )
( ( F || T ) && F )
( T && F )
F
x = false, y = true, z = false
( ( ! x && ( y || z ) ) || ( ! y || z))
( ( ! F && ( T || F ) ) || ( ! T || F ) )
( ( T && T ) || ( F || F ) )
( T || F)
T

Joe