A module collects procedures so other units can use them. The contains block holds procedure bodies.

Program

Play the program to call an area function from a module.

module_use.f90
module geom
    implicit none
contains
    function area(width, height) result(a)
        integer, intent(in) :: width, height
        integer :: a
        a = width * height
    end function area
end module geom

program module_use_demo
    use geom
    implicit none
    integer :: result_
    result_ = area(4, 3)
    print '(I0)', result_
end program module_use_demo
module `module ... end module` defines a reusable unit.
use `use geom` imports the module's public names.
contains `contains` separates the module body from its procedures.