[erlang-questions] Re: Correct syntax of a case clause
Mon Jun 15 19:34:42 CEST 2009
> 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
More information about the erlang-questions