You do not need to have them on separate lines, using a semicolon (;) you can join them on a single line. I’d not suggest to do so very often, its not very good for readability
iex(1)> f = fn [] -> :empty; [_|_] -> :non_empty end
#Function<6.99386804/1 in :erl_eval.expr/5>
iex(2)> f.([])
:empty
iex(3)> f.([1,2,3])
:non_empty
iex(4)> f.(1)
** (FunctionClauseError) no function clause matching in :erl_eval."-inside-an-interpreted-fun-"/1
The following arguments were given to :erl_eval."-inside-an-interpreted-fun-"/1:
# 1
1