[erlang-questions] [clarify] Disjoint when clause
Per Melin
per.melin@REDACTED
Fri May 16 16:39:08 CEST 2008
2008/5/16 Andreas Hillqvist <andreas.hillqvist@REDACTED>:
> I have not tested. But shouldent it work to write it like:
> f(A,B,C) when is_integer(A), is_integer(B), (C =:= foo orelse C =:= bar) ->
> do_stuff(A,B,C).
Comma/semicolon, andalso/orelse and and/or have different priority (in
that order), so you shouldn't need the parens.
f(A,B,C) when is_integer(A), is_integer(B), C == foo orelse C == bar ->
do_stuff(A,B,C).
But the intent is of course communicated more clearly with the parens,
so I would keep them anyway.
More information about the erlang-questions
mailing list