Developer Guide and Reference

ID 767251
Date 10/31/2024
Public
Document Table of Contents

CONTAINS

Statement: Separates the body of a main program, module, submodule, or external subprogram from any internal or module procedures it may contain, or it introduces the type-bound procedure part of a derived-type definition. It is not executable.

CONTAINS

Any number of internal procedures can follow a CONTAINS statement, but a CONTAINS statement cannot appear in the internal procedures themselves.

An empty CONTAINS section is allowed.

Example


PROGRAM OUTER
   REAL, DIMENSION(10) :: A
   . . .
   CALL INNER (A)
CONTAINS
   SUBROUTINE INNER (B)
   REAL, DIMENSION(10) :: B
   . . .
   END SUBROUTINE INNER
END PROGRAM OUTER