You can define anonymous functions using fn:
iex> multiply = fn (x,y) -> x + y end
iex> multiply.(2,3)
6You can use & for shorthand form, where &N refers to the N-th parameter:
iex> multiply = &(&1 * &2)
iex> multiply.(2,3)
6Functions can have multiple clauses using pattern matching:
fn
{:ok, result} -> "Success: #{result}"
{_, error} -> "Error: #{error}"
end