Top: f77 Up: 13 - Statements
Previous: 13,17 - DIMENSION Next: 13,19 - DO_WHILE


Section 13,18: DO

 Executes a block of statements repeatedly until the value of a
 control variable equals, exceeds, or is less than the terminal
 value, according to the control variable specified in the DO loop
 (indexed DO).  The block of statements starts immediately following
 the DO statement.

 You can transfer control out of a DO loop, but not out of a
 parallel DO loop.

 Statement format:

     DO [s[,]] v = e1,e2[,e3]

     s   Is the optional label of an executable statement 
         which follows the DO statement in the same program unit. 
         The label designates the last statement of the DO
         loop. If omitted, an END DO statement is required.

     v   Is the control variable; an integer or real variable
         (it cannot be a record field).  You cannot modify 
         the control variable inside the DO loop.

     e1  Is the initial value of the control variable; an 
         integer or real value.

     e2  Is the terminal value of the control variable; an 
         integer or real value.

     e3  Is the value by which to increment the control 
         variable after each execution of the DO loop; 
         integer or real value.  It cannot be 0. 
         The default of e3 is 1.

 If the iteration count (the number of executions of the DO range)
 is zero or negative, the body of the loop is not executed.  If the
 -nof77 compiler option is specified and the iteration count is zero
 or negative, the body of the loop is executed once.


Top: f77 Up: 13 - Statements
Previous: 13,17 - DIMENSION Next: 13,19 - DO_WHILE