5.1 Module Syntax
Erlang code is divided into modules. A module consists of a sequence of attributes and function declarations, each terminated by period (.).
Example:
- -module(m). % module attribute
- -export([fact/1]). % module attribute
- fact(N) when N>0 -> % beginning of function declaration
- N * fact(N-1); % |
- fact(0) -> % |
- 1. % end of function declaration
For a description of function declarations, see Function Declaration Syntax.