Fortran one-loop nested loops

I am rewriting legacy code and stumbled upon this:

  DO 4 I=1,N
   ...
  DO 4 J=1,N
   ...
4 CONTINUE

There seems to be only one for these two cycles CONTINUE. Is this equivalent to this java code?

for (int i=0; i<n; i++) {
    ...
    for (int j=0; j<n; j++) {
        ...
    }
}
+5
source share
1 answer

I think you are right that this is equivalent.

4 CONTINUE

is the only marked marker for the spot where the cycle ends. Using two CONTINUE statements or better, but using two ENDDOs (if supported by your compiler) would be much clearer.

This page http://www.math.hawaii.edu/lab/197/fortran/fort2.htm agree, just find "the same".

, , Java, Fortran.

+8

All Articles