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

zxq9@REDACTED zxq9@REDACTED
Tue Jul 24 05:41:48 CEST 2018


On 2018年7月22日日曜日 14時25分00秒 JST Viktor Söderqvist wrote:
> Hey everyone,
> 
> I've seen these short-circuit operators with a non-boolean second
> operand, usually where the second operand is doing some side-effect and
> the return value is not important. It seems to be a trend. Example:
> 
>     Msg /= undefined andalso io:format("Message: ~s~n", [Msg]),
> 
> I this good or bad style?

That code should die in a fire and the author should say repent with
the chanting of 100 Hail McCarthys.

-Craig



More information about the erlang-questions mailing list