The question is just playing with you with confusing spacing.
b != b
is the usual !=
(not equals) comparison.
On the other hand:
b =! b
is better written as b = !b
which is parsed as:
b = (!b)
Thus it's two operators.
- First invert
b
.
- Then assign it back to
b
.
The assignment operator returns the assigned value. Therefore, (b =! b)
evaluates to true - which is what you print out.