Module attributes may be used like "constants" which are evaluated at compile-time.
defmodule Example do
@number 2
def number(), do: @number
end
However, they don't strictly behave like constants because they can be overwritten by redefining them in the module:
defmodule Example do
@standard_message "Hello, World!"
@standard_message "Overwritten!"
def message(), do: @standard_message
end