Conditional expressions in Fortran

I. D. Hill · ITNOW · 1972

One of the features of the Algol language that does not appear in many other computer languages, and in particular not in Fortran, is the conditional expression. This feature allows one to write statements such as: k: = if j > 3 then 1 else 2; y: = sqrt (3·0 + (if B then w else z)); Not only does Standard Fortran not have a construction of this type, extended versions of Fortran [e.g. 1 and 2] also lack anything of the sort, while proposals for new versions [e.g. 3, 4, 5, and 6] all fail even to discuss it. Perhaps Fortran users simply do not realise what they are missing. If any of them doubt the utility of such a construction, let them ask any Algol user whether he would willingly do without it. Most programs have many places where such constructions are useful, and they provide a natural way of doing things— easy to write; easy to understand.

Read the paper · More papers on PaperTik