[erlang-questions] if-elseif-else trick

Raimo Niskanen raimo+erlang-questions@REDACTED
Wed Feb 20 12:01:33 CET 2019


On Mon, Feb 18, 2019 at 08:20:33PM +0200, andrei zavada wrote:
> One neat (for some definition of 'neat') trick to do away with `true`
> for the semantic `else` is `el/=se` (spotted in riak code).
> 

Oh dear!  That's creative, actually quite readable, and should compile to
literal 'true'.

You can also use a macro: -define(else, true).
-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list