<div dir="ltr"><div>IMO, it's meaningful.</div><div><br></div><div>Think that,</div><div><br></div><div>Msg /= nil and io:fwrite("blah, blah, ...~n"). %% It won't build a boolean expression.</div><div><br></div><div>But</div><div><br></div><div>Msg /= nil andalso io:fwrite("blah, blah, ...~n"). %% Confirm the Msg is nothing and also say "blah, blah, ..."</div><div><br></div><div>I think the reason why andalso/2 was built. Though, andalso/2 won't be used for a general default value usage like what we saw in JS or Perl, because the first argument of andalso/2 must be either true or false.<br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 23, 2018 at 7:05 PM, Jesper Louis Andersen <span dir="ltr"><<a href="mailto:jesper.louis.andersen@gmail.com" target="_blank">jesper.louis.andersen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">On Sun, Jul 22, 2018 at 9:09 PM Jachym Holecek <<a href="mailto:freza@circlewave.net" target="_blank">freza@circlewave.net</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># Viktor Söderqvist 2018-07-22:<span class=""><br>> <br>
>     Msg /= undefined andalso io:format("Message: ~s~n", [Msg]),<br>
> <br>
> I this good or bad style?<br>
<br>
It is horrible style. Pain to read, pain to modify, pain to reason about.<br>
<br>
Simple clear question deserves a simple clear answer. :-)<br>
<br></span></blockquote></div><div class="gmail_quote"><br></div><div class="gmail_quote"><div style="font-family:arial,helvetica,sans-serif" class="gmail_default">​I don't like the style either, mostly because it messes with the types. andalso and orelse expects boolean expressions, but the style used breaks that format. However, something like</div><div style="font-family:arial,helvetica,sans-serif" class="gmail_default"><br></div><div style="font-family:arial,helvetica,sans-serif" class="gmail_default">[x || Msg /= undefined]</div><div style="font-family:arial,helvetica,sans-serif" class="gmail_default"><br></div><div style="font-family:arial,helvetica,sans-serif" class="gmail_default">doesn't.​</div><span class="HOEnZb"><font color="#888888"><br clear="all"></font></span></div><span class="HOEnZb"><font color="#888888"><br>-- <br><div dir="ltr" class="m_-5158924960273875965gmail_signature" data-smartmail="gmail_signature">J.</div></font></span></div>
<br>______________________________<wbr>_________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/<wbr>listinfo/erlang-questions</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div><br></div>Best Regards.<div><br></div><div>--- Y-H. H.</div><div><br></div></div>
</div>