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 [[email protected]] on behalf of Paul Gilmartin [[email protected]] Sent: Friday, June 5, 2020 5:26 PM To: [email protected] 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 [email protected] with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
