Created
May 19, 2014 16:39
-
-
Save alco/6a154dd7c415d57b01f1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# attr.exs | |
# using module attributes as compile-time constants | |
defmodule M do | |
@constant 13 | |
def a, do: @constant | |
@constant 44 | |
def b, do: @constant | |
end | |
IO.puts "a = #{M.a}; b = #{M.b}" | |
--- | |
λ elixir attr.exs | |
a = 13; b = 44 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment