What is a Module?

In many previous example, there are several internal functions packed at the end of the main program. In fact, many of them such as Factorial(), Combinatorial(), GCD(), and Prime() are general functions that can also be used in other programs. To provide the programmers with a way of packing commonly used functions into a few tool-boxes, Fortran 90 has a new capability called modules. It has a syntactic form very similar to a main program, except for something that are specific to modules.

Syntax

The following is the syntax of a module:
MODULE  module-name
   IMPLICIT  NONE
   [specification part]
CONTAINS
   [internal-functions]
END MODULE  module-name

The differences between a program and a module are the following:

Short Examples

Here are some short examples of modules: