Fortran – Stop Statement

Fortran stop statement

In this guide, we will discuss Fortran Stop Statement. If you wish execution of your program to cease, you can insert a stop statement.

Example

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

When the above code is compiled and executed, it produces the following result −

1
2
3
4

Next Topic : Click Here

This Post Has 2 Comments

Leave a Reply