[erlang-questions] Orelse and andalso as short-hand for case

Dmitry Belyaev be.dmitry@REDACTED
Tue Jul 24 16:17:22 CEST 2018



On 24 July 2018 20:26:57 GMT+10:00, empro2@REDACTED wrote:
>...
>Why not:
>
>  if Pid =:= WorkerPid -> throw({'task', Task}) end,
>

Because it doesn't work for the false case. In Erlang if and case are expressions and they have to be exhaustive and return values for each case. Otherwise they will throw errors.
-- 
Kind regards,
Dmitry Belyaev



More information about the erlang-questions mailing list