From Erlang Community
You want the equivalent of if...then... in other programming languages.
For example, to print a list if it is non-empty, you could write
case L/= of true -> io:format("~p~n",[L]); false -> ok end
if L/= -> io:format("~p~n",[L]); true -> ok end
but in both cases you have to include an "else" branch that is just noise.
How can you avoid this?
[io:format("~p~n",[L]) || L/=]
This is a list comprehension without a generator. If L/= is true, then it evaluates the io:format call (and returns its result in a list of one element), while if it is false, then it just returns the empty list.
This generates a compiler warning, but if you can put up with that, then it's a concise and readable notation.