Erlang: How to "Do Nothing" in true branch of if statement
Erlang does not have the notion of nothing
like void
or unit
. I would suggest returning another atom like not_ok
(or even void
or unit
.)
The best answer is don't use if, just use case.
case A of
B -> ok;
C -> throw({error,a_doesnt_equal_b_or_whatever_you_want_to_do_now})
end
typically ok
or undefined
or noop
are returned as atoms which mean essentially, nothing.