[erlang-questions] Correct syntax of a case clause

Sean Cribbs seancribbs@REDACTED
Sun Jun 14 20:10:50 CEST 2009


If you have only a,b,c as possible matches, I'd do it like this:

case Expr of
  c -> block2;
  _ -> block1
end

info wrote:
> Hi All,
>
> How to formulate a "complex pattern" in a case clause ?
>
> case Expr of
> a,b -> block1;        % if Expr = a or b then block1
>    c -> block2         % if Expr = c then block2
> end
>
> (a,b) gives an error
> What is the correct syntax ?
>
> John
>
>   



More information about the erlang-questions mailing list