[erlang-questions] Simple multi-case

datacompboy datacompboy@REDACTED
Fri Nov 10 11:59:15 CET 2006


Is there simple syntax for simple multi-case clauses?

F.e.: 
  case getstatus(Id) of
     free -> doX();
     online -> doX();
     busy -> doY()
  end
Fine, but what if I need to call two functions?
I want just write
  case getstatus(Id) of
     free || online -> doX(), doZ(), ok;
     busy -> doY()
  end
instead of
  case getstatus(Id) of
     free -> doX(), doZ(), ok;
     online -> doX(), doZ(), ok;
     busy -> doY()
  end
Since there more than one call, but too small code to move it into separate fun.
For now that possible only as
  case getstatus(Id) of
     S when (S==free) orelse (S==online) -> doX(), doZ(), ok;
     busy -> doY()
  end
But may be I have missed something, and there simpler syntax?
--
--- suicide proc near\n call death\n suicide endp
_________________________________________________________
Post sent from http://www.trapexit.org



More information about the erlang-questions mailing list