Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR ELIXIR

elixir anonymous function

iex> sum = fn (a, b) -> a + b end
iex> sum.(2, 3) # 5
# The & Shorthand
iex> sum = &(&1 + &2)
iex> sum.(2, 3) # 5
 
PREVIOUS NEXT
Tagged: #elixir #anonymous #function
ADD COMMENT
Topic
Name
7+3 =