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

Attila Rajmund Nohl attila.r.nohl@REDACTED
Mon Feb 28 14:59:18 CET 2011


2011/2/28, Jachym Holecek <freza@REDACTED>:
[...]
> And about return in general -- in Erlang (and other functional languages)
> program is composed of expressions that get evaluated to values, there are
> no statements. This is the reason why you do things like:
>
>    A = case (X rem 2) of
> 	   0 ->
> 	       even;
> 	   1 ->
> 	       odd
>        end
>
> which quite annoyingly you can't do in C.

I might misunderstand something, but

A = (X % 2 == 0) ? even : odd;

can be done in C ...


More information about the erlang-questions mailing list