Modules
Steve Lantz, Adam Brazier (revisions)
Cornell Center for Advanced Computing
Revisions: 2/2023, 10/2014, 6/2012 (original)
Modules provide the way to package global data and derived types with subprograms, etc. Parts of a module can be kept hidden from other parts of the program by making a particular variable, declaration, or subprogram private. A module is accessed by adding the use
statement to a program unit (main program or subprograms).
Objectives
After you complete this topic, you should be able to:
- Define a module in source code
- Use the module in other program units
- Write a module that contains subroutines and functions
- Implement derived types in a module
Prerequisites
- Familiarity with an editor
- Knowledge of how to execute simple commands on the command line
- Some basic understanding of what a computer language is