Why do some people shun `if`?

zxq9 zxq9@REDACTED
Sun Aug 15 15:20:49 CEST 2021


On 2021/08/15 22:15, Jesper Louis Andersen wrote:
> There are uses for the if...end construct in Erlang. The reason you 
> often shun it is because it occurs quite rarely in a language where you 
> have a proper case...end matching construct. So to avoid newcomers to 
> fall into a trap of using if all the time, you write it down in the 
> style guide.
This sentence, generalized, should be in ever style guide for every 
language -- and not just for `if` vs proper `case`.

I don't have time to expand on the intuition this triggered, but it is a 
really great expression. Thanks, Jesper!

-Craig


More information about the erlang-questions mailing list