如果想执行的程序停止,可以插入一个stop语句。
示例
program stop_example
implicit none
integer :: i
do i = 1, 20
if (i == 5) then
stop
end if
print*, i
end do
end program stop_example
当上述代码被编译和执行时,它产生了以下结果:
1 2 3 4