What languages (if any) support the syntax:
a < b < c
where this evaluates as "a
is less than b
and b
is less than c
"?
Why do so many languages lack this feature?
What languages (if any) support the syntax:
a < b < c
where this evaluates as "a
is less than b
and b
is less than c
"?
Why do so many languages lack this feature?
Python is definitely one!
And Clojure according to https://til.hashrocket.com/posts/tceb6f2vxe-interval-comparison-in-javascript
See How do I check whether an int is between the two numbers? => this is called "interval comparison."
See also Why are interval comparisons (e.g: x < variable < y) not supported in most "mainstream" languages?