END statement

Standard: (F77) F90 F95 F2003 F2008 F2018 Example program


<Syntax>

END [ program-unit [ name ] ]

program-unit ::= BLOCK DATA | FUNCTION | MODULE | PROGRAM | SUBMODULE | SUBROUTINE

The name shall be the name of the program unit; it is not permitted on the END statement of an unnamed main program or block data subprogram.

Prior to Fortran 2008, the FUNCTION or SUBROUTINE keyword is required on the END statement of a contained subprogram (i.e. a module procedure or internal procedure).

<Semantics>

The END statement ends a program unit or a contained subprogram. If an END statement is executed in a FUNCTION or SUBROUTINE, it has the effect of a RETURN statement; in a main program it has the effect of a STOP statement.

<Related>

END FUNCTION statement, END MODULE statement, END PROGRAM statement, END MODULE statement, END SUBMODULE statement, END SUBROUTINE statement, RETURN statement, STOP statement