Improvement to switch-case statement

Jarrett Billingsley jarrett.billingsley at gmail.com
Thu Jan 1 11:32:58 PST 2009


On Thu, Jan 1, 2009 at 12:45 PM, Nick Sabalausky <a at a.a> wrote:
>
> Not a bad idea. How does it handle something like this:
>
> if( a > b < c)
>
> Is that an error? Or does it get split into:
>
> if( a > b && b < c)

>From the Python docs:

"Formally, if a, b, c, ..., y, z are expressions and opa, opb, ...,
opy are comparison operators, then a opa b opb c ...y opy z is
equivalent to a opa b and b opb c and ... y opy z, except that each
expression is evaluated at most once.

Note that a opa b opb c doesn't imply any kind of comparison between a
and c, so that, e.g., x < y > z is perfectly legal (though perhaps not
pretty). "



More information about the Digitalmars-d mailing list