j3-fortran / fortran_proposals

Proposals for the Fortran Standard Committee
178 stars 15 forks source link

[Syntactic Sugar] chained comparisons #173

Open Leonard-Reuter opened 4 years ago

Leonard-Reuter commented 4 years ago

Allow for writing

if (1 < 2 < 3)

instead of

if (1 < 2 .and. 2 < 3)

Similar to python https://docs.python.org/3/reference/expressions.html#comparisons.

I think, this is very much in the spirit of "formula translation" =)

(Yup, this is nothing but syntactic sugar, but sugar is sweet)