Hello, I am new to elixir and I am trying to call my anonymous function defined in my “ex” file like so:
package_data = fn
(x, [y]) -> [x, y]
(x, 5) -> x + 20
(x, y) -> {x, y}
end
When I compile this file using “iex -S mix” and try calling “package_data.(5, 8)” I get “undefined variable “package_data””. Is this just how elixir behaves when using variables in iex, or am I doing something wrong?