develooper Front page | perl.perl5.porters | Postings from March 2020

Re: chained comparisons

Thread Previous | Thread Next
From:
Zefram via perl5-porters
Date:
March 6, 2020 19:50
Subject:
Re: chained comparisons
Message ID:
20200306194954.nfoskodobcnwma46@fysh.org
David Nicol wrote:
>does it short-circuit as soon as possible starting from the left, on
>failure? that is, when A is greater than B, C<<  A <= B <= C >> won't
>evaluate C?

Yes, it does short-circuit in that case, and won't evaluate C.

>also can the with and without equals versions (lt, le), (<, <=), (gt, ge),
>and (>, >=) chain together

Yes, all of those operators chain with each other.

-zefram

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About