[erlang-questions] Re: Correct syntax of a case clause
Michael Radford
mrad-direct-erlang@REDACTED
Mon Jun 15 19:34:42 CEST 2009
info writes:
> Hey that was my question .... and you wander from my subject !
> [...]
> The question was "is it possible to group two patterns in a case ?"
>
> In another pseudo code:
> if Expr = pattern1 OR Expr = pattern2 then do_1;
> if Expr = pattern3 then ...
> ...
I'm pretty sure another poster already gave this solution, but anyway,
yes, you can use guards:
case Expr of
X when X =:= a ; X =:= b -> do_1;
c -> do_2
end
Mike
More information about the erlang-questions
mailing list