[erlang-questions] is there "return" in Erlang.

yted <>
Mon Feb 28 04:55:58 CET 2011


hello Wang:
in fact "case" do work, like the codes below:

judge() ->
A = getA(),
B = getB(),
case [A,B] of
[CONF1, _] ->
doSomeThing(A);
[_, CONF2] ->
doOtherThing(B);
[_,_] ->
doThings()
end.


2011/2/28 Wang Wei <>

> Hello, I has a question about how to convert the bellow C program into
> Erlang.
>
> void judge()
> {
>    int a;
>    int b;
>
>    a = getA();
>    if (a == CONF1)
>   {
>       doSomeThing(a);
>       return;
>   }
>
>   b = getB();
>   if (b == CONF2)
>   {
>       doOtherThing(b);
>        return;
>   }
>
>   doThings();
>   return;
> }
>
> I think about "case" and "if" construct, but none of it seems work fine,
> thanks for help.


More information about the erlang-questions mailing list