Perl chained compares reevaluate terms: foo < rand() bar can give unexpected 
results.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3

________________________________________
From: IBM Mainframe Discussion List [IBM-MAIN@LISTSERV.UA.EDU] on behalf of 
Paul Gilmartin [0000000433f07816-dmarc-requ...@listserv.ua.edu]
Sent: Friday, June 5, 2020 5:26 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: COBOL Question

On Fri, 5 Jun 2020 20:54:37 +0000, Seymour J Metz wrote:

>SMOD (IND1) = 'B' OR 'R' means (SMOD (IND1) = 'B') OR (SMOD (IND1) = 'R'); 
>syntax for implied comparands exists in other languages as well.
>
I have dealt with a language (Mainsail) that had a ternary compare:
    A <= B < C
I don't know whether it avoided side effects of evaluating B twice.
It probably (I'm not sure) short-circuited to avoid evaluating C
needlessly.

I like semi-open intervals, especially in loops.

-- gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to