Can set up a DO loop which is terminated by simply jumping out of it. Consider,
i = 0 DO i = i + 1 IF (i .GT. 100) EXIT PRINT*, "I is", i END DO ! if i>100 control jumps here PRINT*, "Loop finished. I now equals", i
this will generate
I is 1 I is 2 I is 3 .... I is 100 Loop finished. I now equals 101
The EXIT statement tells control to jump out of the current DO loop.
For more information, click here