End

Statement Purpose

The END statement marks the end of a program unit. This statement must appear whenever you finish a program unit.

Examples and rules of use

The END statement can appear in either a specific form or a generic form. The specific form is the END statement followed by the type of program unit that it is terminating. The five program units that this works for have their specific end cards shown below.
		end module
		end program
		end subroutine
		end function
		end blockdata
If you want to make your END cards even more specific, you caninclude the name of the procedure after the procedure type. For instance, if I had a written a function that I called "func1", I could have used this statement
		end function func1
instead of the simpler END FUNCTION statement. Finally, you can use the generic form of the end statement in place of any of the above end statements if you so desire. The generic form is just simply the END all by itself like the following.
end

This generic form will work for all of the procedures mentioned above, except when you are marking the end of an internal procedure. In this case you always have to denote the end of an internal procedure with the specific form of the END statement. In case you are unclear as to when this situation occurs, it is whenever you have a procedure that appears inside of an interface block, or one that is listed after a contains statement.

For specific examples see:

end module: trapz2.f and fall2.f

generic end: arith.f and newton1.f

end function: odeint.f and external.f

end subroutine: fall.f and contains.f

end blockdata: fall.f

	

Up one level / Home


Written by Jason Wehr : jcw142@psu.edu and Maintained by John Mahaffy : jhm@cac.psu.edu