OR construction in erlang ?

Dan Gudmundsson <>
Wed Apr 13 08:35:13 CEST 2005

Olivier writes:
 > I guess I'll have to do that, but it is basically a case / catch syntax 
 > : how would you do it in this case:
 > ...
 > true = lists:member(Key, List),
 > false = lists:member(Key2, List),
 > ...

We use a macro in our tests like:

?match(true, lists:member(Key, List)),
?match(false, lists:member(Key2, List)),

        fun() ->
               AcTuAlReS = (catch (Expr)),
               case AcTuAlReS of
                   ExpectedRes ->
                       ?verbose("ok, ~n Result as expected:~p~n",[AcTuAlReS]),
                   _ ->
                       ?error("Not Matching Actual result was:~n ~p~n",

The nice thing with a macro is that you can also use ?MODULE,?LINE
to get the location.


More information about the erlang-questions mailing list