Almost as much fun as an assigned GOTO, the arithmetic IF statement was originally the only IF-type branch provided by FORTRAN 66, one of the few programming languages suitable for the Klingon programmer. Unlike the various structured programming concepts of the weak and timid, the arithmetic IF doesn't try to impose structure (or stricture) on your program.

Arithmetic IF is truly a post-modern programming construct: it does not impose the false Cartesian/Aristotelian dichotomies inherent in the IF/ELSE structure. Nor does block nonlinear thought by the block structure inherent in END IF.

The statement looks like this:

IF expression L1,L2,L3
where L1, L2 and L3 are labels. Execution proceeds by evaluating expression. If its value is negative, control continues at label L1; if it is zero, control continues at L2; and if it's positive, control continues at L3. Simple, elegant, 3-way; 3 GOTOs, in one elegant syntactic package.

Nowadays (indeed, ever since Fortran 77) Fortran provides IFs that look like IFs, and even have multiline structure. Sadly, the arithmetic IF has been placed on the obsolescent features list of Fortran 95, the Fortran Endangered Features List.

Log in or register to write something here or to contact authors.