cycle语句使循环跳过它的主体的其余部分,并立即重新测试其条件在声明之前。
流程图
例子
program cycle_example
implicit none
integer :: i
do i = 1, 20
if (i == 5) then
cycle
end if
print*, i
end do
end program cycle_example
当上述代码被编译和执行时,它产生了以下结果:
1 2 3 4 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20