Simple question
Nico Weling
nico.weling@REDACTED
Tue Aug 28 15:23:50 CEST 2001
Thank you it's working!
Regards,
Nico.
Richard Carlsson wrote:
>
> On Tue, 28 Aug 2001, Nico Weling wrote:
>
> > Hi Erlang freaks,
>
> Hi!
>
> > I need OR within an case clause. ...
> > Is this possible, and if, how is the syntax.
>
> Try this:
>
> case Name of
> X when X == peter; X == klaus; X == carsten ->
> io:format("Is a man~n",[]);
> X when X == anna; X == birgit; X == petra ->
> io:format("Is a woman~n", []);
> _ ->
> io:format("Is a Zombie~n", [])
> end.
>
> In other words, in a guard, you can have a ';'-separated sequence of
> alternative conditions (a disjunction), where each condition is a
> ','-separated sequence of boolean tests (a conjunction).
>
> (You could also use 'if' instead of 'case' for the above.)
>
> /Richard
>
> Richard Carlsson (richardc@REDACTED) (This space intentionally left blank.)
> E-mail: Richard.Carlsson@REDACTED WWW: http://www.csd.uu.se/~richardc/
--
Nico Weling
Software Designer
Ericsson Eurolab Deutschland GmbH
Verification Tool Design
Tel: +49 2407 575 5217
Fax: +49 2407 575 651
Dect:+49 2407 575 89339
mailto:Nico.Weling@REDACTED
More information about the erlang-questions
mailing list