int a = 10, b = 12, c = 8
!((a < 5) || (c < (a + b)))
I just tried it in a compiler and it was false.
int a = 10, b = 12, c = 8
!((a < 5) || (c < (a + b)))
I just tried it in a compiler and it was false.
The inner expression:
(a < 5) || (c < (a + b))
evaluates a < 5
as false
(since a
is 10
) and c < (a + b)
as true
(since 8
is less than 10+12
). Performing a Boolean "or" operation on false
and true
gives you true
.
And, given that the next thing you do to that value is the !
(inversion), that true
turns into a false
.
c < (a + b) == 8 < (10 + 12) == 8 < 22 == true
a < 5 == 10 < 5 == false
(a < 5) || (c < (a + b)) == false || true == true
!((a < 5) || (c < (a + b))) == !(true) == false