How do comparisons such as 2 == 2 > 1
work?
- operator_chaining
- chaining
From 6.10 - Comparisons:
Comparisons can be chained arbitrarily, e.g.,
x < y <= z
is equivalent tox < y and y <= z
This is true even for comparison operators that don’t have greater-than or less-than symbols, such as ==
or in
.