DO WHILE construct

The DO WHILE construct specifies the repeated execution of a statement block for as long as the scalar logical expression specified in the DO WHILE statement is true. You can curtail a specific iteration with the CYCLE statement, and the EXIT statement terminates the loop.

Read syntax diagramSkip visual syntax diagram
>>-DO_WHILE_statement------------------------------------------><

Read syntax diagramSkip visual syntax diagram
>>-statement_block---------------------------------------------><

Read syntax diagramSkip visual syntax diagram
>>-+-END_DO_statement---+--------------------------------------><
   '-terminal_statement-'   

DO_WHILE_statement
See DO WHILE for syntax details
END_DO_statement
See END (Construct) for syntax details
terminal_stmt
is a statement that terminates the DO WHILE construct. See The terminal statement for details.

The rules applicable to the DO construct names and ranges, active and inactive DO constructs, and terminal statements also apply to the DO WHILE construct.

Examples

I=10
TWO_DIGIT: DO WHILE ((I.GE.10).AND.(I.LE.99))
  J=J+I
  READ (5,*) I
END DO TWO_DIGIT
END