Debian Codegraph @

tests/indent/erlang.erl

raw
1 -module(mymod).
2 -export([process/1, classify/1, loop/0]).
3
4 process(Items) ->
5 Total = lists:foldl(
6 fun(X, Acc) ->
7 X + Acc
8 end,
9 0,
10 Items
11 ),
12 case Total of
13 0 ->
14 zero;
15 _ ->
16 many
17 end.
18
19 classify(X) ->
20 if
21 X > 0 ->
22 positive;
23 true ->
24 other
25 end.
26
27 loop() ->
28 receive
29 {msg, Data} ->
30 handle(Data);
31 stop ->
32 ok
33 end.
34
35 safe(F) ->
36 try F() of
37 Result ->
38 Result
39 catch
40 error:Reason ->
41 {error, Reason}
42 after
43 cleanup()
44 end.
45
46 build() ->
47 #{
48 name => "test",
49 items => [
50 1,
51 2
52 ]
53 }.