I'm rewriting some legacy code and came across this:
DO 4 I=1,N
...
DO 4 J=1,N
...
4 CONTINUE
There appears to be only one CONTINUE
for these two loops. Is it equivalent to this Java code?
for (int i=0; i<n; i++) {
...
for (int j=0; j<n; j++) {
...
}
}
I think you are correct as to what it is equivalent to. The
4 CONTINUE
is just a labeled marker for the spot where the loop ends. Using two CONTINUE statements, or even better yet using two ENDDO (if supported by your compiler) would have been much clearer.
This page http://www.math.hawaii.edu/lab/197/fortran/fort2.htm concurs, just search for "same continue".
One detail though is that I don't think your loop variable start and end values are the same in your Java code as in the Fortran code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With