[erlang-questions] Simple multi-case

Christian S chsu79@REDACTED
Fri Nov 10 13:21:39 CET 2006

> 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

case Do of
  x -> doX();
  y -> doY();

Not less typing, but perhaps a more table-like overview of what to do
and thus more readable code.

More information about the erlang-questions mailing list