-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdoc.erl
35 lines (29 loc) · 953 Bytes
/
doc.erl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
-module(doc).
-export([sum/2, example/0]).
%%% Conventions
%% In Erlang there are three types of comments in use.
%%
%% First one starts with three % chars (%%%). These are comments about the
%% module.
%% Second is %% (two % chars) - comments about the function.
%% Last one is single % character - about Erlang code.
%%% API functions - module level comment
example() ->
%% prints some text - function level comment
io:format("hello~n"). % statement level comment
%% @doc Short description
%%
%% Then empty line and longer description.
%%
%% To specify type of the function you use -spec directive
%%
%% @see http://www.erlang.org/doc/reference_manual/typespec.html
-spec sum(integer(), integer()) -> integer(). % notice the dot at the end
sum(A, B) ->
A + B.
%%% Type specyfications
%% for list of possible types see
%% http://www.erlang.org/doc/reference_manual/typespec.html
%%% TypEr
%% you can use typer
%% $ typer filename.erl