=:= vs == and a shorter version of if
Mon Apr 18 14:51:26 CEST 2005
(joel reymont) writes:
> Should I always use =:= instead of == if I don´t need type conversion?
> How much more efficient is that?
Hardly noticable. It will cost you one more character to type :-)
Ordinary matching uses =:= so it is the one you really often want
to use, but == only differs for float vs integer so it is mostly
> Also, is there a shorter way of saying the following?
> SomeCondition ->
> true ->
> Thanks, Joel
if SomeCondition -> dostuff;
true -> ok end.
%% Sorry about that, could not resist... this might be better:
SomeCondition andalso dostuff. % Warning! not tail recursive.
/ Raimo Niskanen, Erlang/OTP, Ericsson AB
More information about the erlang-questions