Strange label usage for an IF condition in a DO loop [duplicate]
Solution 1:
Wow ... I haven't seen that syntax in a while. That is a Fortran Arithmetic IF Statement. The result of KODE(J)
is a number. If it is less than zero, then the first jump is used, if it is equal to zero, then the second jump is used, otherwise, the third jump is used. This is roughly equivalent to:
X=KODE(J)
IF (X.LT.0) GO TO 55
IF (X.EQ.0) GO TO 55
GO TO 40
My Fortran skills have faded significantly, but this is what I remember.
In this particular case, even simpler for programmer to write
X=KODE(J)
IF (X.LE.0) GO TO 55
GO TO 40
Solution 2:
An "arithmetic if" statement was the IF statement of very early Fortran. The conventional IF statement (aka "logical" if) was introduced in Fortran IV in 1962 (http://en.wikipedia.org/wiki/Fortran#FORTRAN_IV). An arithmetic IF statement is the sign of really old code (FORTRAN II !), or a programmer following such a style.
The Arithmetic If statement was listed as "obsolescent" in Fortran 90 as a warning that the feature might be deleted from the language in the future.