Skip to content

Instantly share code, notes, and snippets.

@talentdeficit
Created April 27, 2011 04:03
Show Gist options
  • Save talentdeficit/943697 to your computer and use it in GitHub Desktop.
Save talentdeficit/943697 to your computer and use it in GitHub Desktop.
15> Z = fun(X) -> X = true end.
#Fun<erl_eval.6.13229925>
16> Z(false).
** exception error: no match of right hand side value true
17> try Z(false) catch error:badmatch -> ok end.
** exception error: no match of right hand side value true
18> try Z(false) catch error:Type -> Type end.
{badmatch,true}
@rampage
Copy link

rampage commented Apr 27, 2011

4> try Z(false) catch error:Type -> Type end.
{badmatch,true}
5> try Z(false) catch error:Type -> [Type] end.
[{badmatch,true}]
6> try Z(false) catch error:{badmatch,true} -> ok end.
ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment