Skip to main content

Lambda Functions

Lambda functions or Anonymous functions are created with the keyword fn

> add = fn x -> x + 1 end
> add(1)
2

The syntax of creating a lambda function is the keyword followed by args and then the -> operator followed by the return expr and ending with end keyword

fn <arg/args> -> <return-expr> end