Something went wrong. Try again.
forked from verus-lang/verus
Something went wrong. Try again.
Chained operators #
Syntax #
V@[chained_expr] ::= V@[spec_expr] V@[cmp_op] V@[spec_expr] (V@[cmp_op] V@[spec_expr])+
V@[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.