Welcome to Elixir @Earl
This is returning the capture IO.puts. The parameter message is unused in the above code.
You might have got a warning when the code was compiled.
warning: variable "message" is unused (if the variable is not meant to be used, prefix it with an underscore)
iex:10: ModuleName.talk/1
We can remove the unused variable message from the code.
If you want to print Hello World, you will have to do something like this -
defmodule ModuleName do
def talk(), do: &IO.puts/1
end
# then in iex
iex> ModuleName.talk().("Hello World")
Hello World
:ok
One other thing is IO.puts returns :ok - it writes “Hello World” to standard output.
Edit: added info about IO.puts return






















