On 1/19/06, Joe Gottman <[EMAIL PROTECTED]> wrote:
>    Suppose I have code that looks like this:
>
>             my ($x, $y, $z) = (1, 2, 3);
>
>             say "sorted backward" if ++$x > ++$y > ++$z;
>
>
>
> Will $z be incremented even though the chained comparison is known to be
> false after ++$x and ++$y are compared?

I don't see a reason for chained comparisons not to short-circuit,
besides the surprise factor.  But anyone who knows about &&, and
understands chained comparisons as expanding to &&, should understand
short-circuiting behavior.

Luke

Reply via email to