[erlang-questions] : Simple multi-case

Raimo Niskanen raimo+erlang-questions@REDACTED
Fri Nov 10 13:52:16 CET 2006


Or nest them:
    case case getstatus(Id) of
             free -> x;
             online -> x;
             busy -> y
         end of
        x -> doX();
        y -> doY();
    end.

On Fri, Nov 10, 2006 at 01:21:39PM +0100, Christian S wrote:
> > For now that possible only as
> >   case getstatus(Id) of
> >      S when (S==free) orelse (S==online) -> doX(), doZ(), ok;
> >      busy -> doY()
> >   end
> 
> Do =
> case getstatus(Id) of
>   free    -> x;
>   online -> x;
>   busy    -> y
> end,
> 
> case Do of
>   x -> doX();
>   y -> doY();
> end.
> 
> Not less typing, but perhaps a more table-like overview of what to do
> and thus more readable code.
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list