Constants
Elixir doesn't offer constants per say, but developers can use module attributes as constants.
defmodule MyModule do # A number constant @constant 0.1 # Another constant @greeting "Hello, world!" def get_constant() do @constant end def hello() do @greeting end end IO.inspect(MyModule.get_constant()) IO.inspect(MyModule.hello())
$ elixir constants.exs 0.1 "Hello, world!"