next up previous contents
Next: Indexed DO Loops Up: Control Constructs Previous: Named and Nested Loops

 

DO ... WHILE Loops

If a condition is to be tested at the top of a loop a DO ... WHILE loop could be used,

    DO WHILE (a .EQ. b)
     ...
    END DO

The loop only executes if the logical expression evaluates to .TRUE.. Clearly, here, the values of a or b must be modified within the loop otherwise it will never terminate.

The above loop is functionally equivalent to,

    DO; IF (a .NE. b) EXIT
     ...
    END DO

For more information, click here gif


next up previous contents
Next: Indexed DO Loops Up: Control Constructs Previous: Named and Nested Loops

©University of Liverpool, 1997
Wed May 28 23:37:18 BST 1997
Not for commercial use.