Module (Fortran)

Applies to: fortran

A Fortran module is a container for related procedures, types, and constants, the unit of reuse in modern Fortran. Other code gains access with use. It replaces old-style COMMON blocks and gives the compiler the interfaces it needs to check calls.

module geometry
  implicit none
contains
  function area(r) result(a)
    real, intent(in) :: r
    real :: a
    a = 3.14159 * r * r
  end function
end module

See also: intent