Use the @
symbol to create module attributes, which can then be used as constants
by functions in your module:
defmodule Robot do
@name "R080T"
def greet do
IO.puts "Greetings from #{@name}!"
end
end
Use the @
symbol to create module attributes, which can then be used as constants
by functions in your module:
defmodule Robot do
@name "R080T"
def greet do
IO.puts "Greetings from #{@name}!"
end
end