Étude 9-1: try
and catch
Update the stats
module that you wrote in Étude 7-3
so that it will catch errors in the minimum/1
, maximum/1
,
mean/1
and stdv/1
functions.
Here is some sample output.
1>
c
(
stats
).
{ok,stats}
2>
stats
:
minimum
([]).
{error,badarg}
3>
stats
:
mean
([]).
{error,badarith}
4>
stats
:
mean
([
"123"
,
456
]).
{error,badarith}
5>
stats
:
stdv
([]).
{error,badarith}
Get Études for Erlang now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.