1

I've come across this FORTRAN statement from a model written in FORTRAN 77 . I've no clue what it means. Would be glad if someone can shed some light.

Here is how the code looks:

IF(NC)20,20,10

Note: NC is a variable (I think), and the numbers that follow are label statements (I think).

My question is, what does the above statement mean? I understand that, usually, after the "IF" statement, there should be an argument in the bracket, e.g. (a < 20). However, in this case, there is only a variable in the bracket.

1 Answers1

5

This is an arithmetic if from the Fortran I days. No longer available from F90 onwards. It is a direct translation from the IBM 3 way jump instruction in IBM assembler. Not many machine architectures have 3 way jumps nowadays.

if (x) 10, 20, 30

means

if (x .lt. 0) goto 10
if (x .eq. 0) goto 20
if (x .gt. 0) goto 30  ! if statement not strictly necessary

So in your case it means

if (nc .le. 0) goto 20
if (nc .gt. 0) goto 10
cup
  • 7,589
  • 4
  • 19
  • 42