Question about 'if'

Bengt Kleberg bengt.kleberg@REDACTED
Wed Jun 9 06:40:34 CEST 2004


Marc van Woerkom wrote:

> why is
>   if     f(X) =:= 42 ->
>        ..
>   end
>
> not allowed, but
>
>   Y = f(X),
>   if
>     Y =:= 42 ->
>     ..
>   end

most likely it is this way to ensure that the 'if branch selection' is 
done in bounded time.
assume that the choosing of a branch is done inside the virtual machine. 
in your first example that means that f(X) would run to compleation, 
without letting any other process run.


bengt



More information about the erlang-questions mailing list