Why do some people shun `if`?
Michael P.
empro2@REDACTED
Tue Aug 17 12:03:50 CEST 2021
On Mon, 16 Aug 2021 16:39:51 +0800
Vance Shipley <vances@REDACTED> wrote:
> Why I find 'if' awkward is that when I test a condition for the success
> path and have a fall through clause for the fail path the semantics don't
> match with 'true'.
>
> if
> Foo == 42 ->
> ok;
> true ->
> {error, Foo}
> end.
I cannot identify any "falling through":
no 'C-switch-case-no-break',
not in the "true" = 'C-switch-default' or 'else'.
I think I remember having employed some
`-define(if_not, true)`
when negation-or-ing all previous conditions
seemed too "dangerous".
~M
--
But who will test the tests?
More information about the erlang-questions
mailing list