Modules
Modules are collections of functions grouped together, under some name. We call a module's function like so:
defmodule MyModule do @doc "Print hello to the screen" def hello do IO.puts("Hello, world!") end @doc "Print goodbye to the screen" def bye do IO.puts("Goodbye!") end end MyModule.hello() MyModule.bye()
$ elixir modules.exs Hello, world! Goodbye!