-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbad.erl
51 lines (42 loc) · 857 Bytes
/
bad.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
ex_case(Animal) ->
case Animal
of
spider ->
scary;
bunny ->
not_scary
end.
ex_if(Animal) ->
if
Animal == cat ->
boo;
Animal == bear ->
run_away;
true ->
pet_it
end.
ex_receive(Msg) ->
receive
Msg ->
received;
_Other ->
not_received
after 1000 ->
got_bored
end.
ex_try(Car) ->
try
start_engine(Car)
catch throw:missing_keys ->
missing_keys
end.
ex_try_of(Car) ->
try start_engine(Car)
of
started ->
started;
{not_started, Reason} when Reason == ford ->
obviously
catch throw:missing_keys ->
missing_keys
end.