What do you call "X <= $foo <= Y" comparison?

Posted by Jakob on Programmers See other posts from Programmers or by Jakob
Published on 2012-08-27T05:13:38Z Indexed on 2012/08/27 21:55 UTC
Read the original article Hit count: 278

While writing a Perl statement like if ( $foo >= X && $foo <= Y ) yet again, I wondered why many programming languages do not support the more comfortable form if ( X <= $foo <= Y ) and what this is called. I came up with "3-legged comparison" but no results when searching for it. By the way there is also the "element-of-set" form if ( $foo in X..Y ) which I only consider more readable when provided via a short keyword.

Is there a term for X <= $foo <= Y comparison? Which languages support it?

© Programmers or respective owner

Related posts about terminology

Related posts about language-features