3.6 Fun

A fun is a functional object. Funs make it possible to create an anonymous function and pass the function itself — not its name — as argument to other functions.


  1. 1> Fun1 = fun (X) -> X+1 end.
  2. #Fun<erl_eval.6.39074546>
  3. 2> Fun1(2).
  4. 3

Read more about funs in Fun Expressions. For more examples, see Programming Examples.