The ==
operator returns true
if the left and right hand operands are equal.
a == b
will return true
when they are equal.
b == c
will return true
when they are equal.
a == b == c
however, will return true when a == b
evaluates to the same value as c
.
You will want to use (a == b) && (b == c)
to achieve what you're trying to achieve.