Skip to content

Commit

Permalink
[#538] Add missing escripts
Browse files Browse the repository at this point in the history
  • Loading branch information
robertoaloi committed Mar 17, 2020
1 parent 2f0f469 commit 293e4e0
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
25 changes: 25 additions & 0 deletions priv/code_navigation/src/diagnostics_errors.escript
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env escript
%% -*- erlang -*-
%%! -smp enable -sname factorial -mnesia debug verbose
%% Sample escript taken from: http://erlang.org/doc/man/escript.html
main([String]) ->
try
N = list_to_integer(String),
F = fac(N),
io:format("factorial ~w = ~w\n", [N,F])
catch
_:_ ->
usage()
end;
main(_) ->
usage().

usage() ->
io:format("usage: factorial integer\n"),
halt(1).

fac(0) -> 1;
fac(N) -> N * fac(N-1).

func tion_with_error() ->
ok.
24 changes: 24 additions & 0 deletions priv/code_navigation/src/diagnostics_warnings.escript
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env escript
%% -*- erlang -*-
%%! -smp enable -sname factorial -mnesia debug verbose
%% Sample escript taken from: http://erlang.org/doc/man/escript.html
main([String]) ->
try
N = list_to_integer(String),
F = fac(N),
io:format("factorial ~w = ~w\n", [N,F])
catch
_:_ ->
usage()
end;
main(_) ->
usage().

usage() ->
io:format("usage: factorial integer\n"),
halt(1).

fac(0) -> 1;
fac(N) -> N * fac(N-1).

unused() -> 0.

0 comments on commit 293e4e0

Please sign in to comment.