Fortran Stop語句

如果想執行的程式停止,可以插入一個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

上一篇: Fortran Cycle語句 下一篇: Fortran數字