# 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

Parent topic: E to F

## See Also

Program Units and Procedures
Branch Statements
Program Termination