You can send in a function as parameter and then call that function (with .(
...)
) like this:
iex> defmodule MyModule do
> def my_method(choice) do
> choice.("hello")
> end
> end
and then call it by using &
before the module name like:
iex> MyModule.my_method(&String.upcase/1)
"HELLO"