Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 9/08/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

END

Statement: Marks the end of a program unit. It takes one of the following forms:

END [PROGRAM [program-name]]

END [FUNCTION [function-name]]

END [SUBROUTINE [subroutine-name]]

END [MODULE [module-name]]

END [SUBMODULE [module-name]]

END [BLOCK DATA [block-data-name]]

In main programs, function subprograms, and subroutine subprograms, END statements are executable and can be branch target statements. If control reaches the END statement in these program units, the following occurs:

  • In a main program, execution of the END statement initiates normal termination of the image that executes it.

  • In a function or subroutine subprogram, a RETURN statement is implicitly executed.

The END statement cannot be continued in a program unit, and no other statement in the program unit can have an initial line that appears to be the program unit END statement.

The END statements in a module or block data program unit are nonexecutable.

Example
C   An END statement must be the last statement in a program
C   unit:
    PROGRAM MyProg
    WRITE (*, '("Hello, world!")')
    END
C
C   An example of a named subroutine
C
    SUBROUTINE EXT1 (X,Y,Z)
      Real, Dimension (100,100) :: X, Y, Z
    END SUBROUTINE EXT1