Chained operators
Syntax
chained_expr ::= spec_expr cmp_op spec_expr (cmp_op spec_expr)+
cmp_op ::= < | <= | > | >= | ==
Typing
All operands in a chained expression must be integer types.
The expression returns bool.
Semantics
A chained comparison desugars into the conjunction of all adjacent pairs, with each intermediate value shared between consecutive comparisons:
a op1 b op2 c op3 d ≡ a op1 b && b op2 c && c op3 d
For example, a <= b < c is equivalent to a <= b && b < c.