DO iteration loop control takes the following form:
Rules and Behavior
A DO variable or expression of type real is a deleted feature in Fortran 95; it was obsolescent in Fortran 90. Compaq Fortran fully supports features deleted in Fortran 95.
The following steps are performed in iteration loop control:
The increment parameter (expr3) is optional and must not be zero. If an increment parameter is not specified, it is assumed to be of type default integer with a value of 1.
MAX(INT((expr2 - expr1 + expr3)/expr3), 0)
The iteration count is zero if either of the following is true:
expr1 > expr2 and expr3 > 0 expr1 < expr2 and expr3 < 0
After termination, the DO variable retains its last value (the one it had when the iteration count was tested and found to be zero).
The DO variable must not be redefined or become undefined during execution of the DO range.
If you change variables in the initial, terminal, or increment expressions during execution of the DO construct, it does not affect the iteration count. The iteration count is fixed each time the DO construct is entered.
The following example specifies 25 iterations:
DO 100 K=1,50,2
K=49 during the final iteration, K=51 after the loop.
The following example specifies 27 iterations:
DO 350 J=50,-2,-2
J=-2 during the final iteration, J=-4 after the loop.
The following example specifies 9 iterations:
NUMBER=37 during the final iteration, NUMBER=41 after the loop. The terminating statement of this DO loop must be END DO.
For More Information:
For details on obsolescent features in Fortran 95 and Fortran 90, as well as features deleted in Fortran 95, see Appendix A.