iex(5)> IO.puts("hello world")
hello world
:ok
iex(6)> :math.exp(3)
20.085536923187668
When calling IO.puts
, no need ":" before IO
.
when calling :math
, need ":" before math.
Why?
iex(5)> IO.puts("hello world")
hello world
:ok
iex(6)> :math.exp(3)
20.085536923187668
When calling IO.puts
, no need ":" before IO
.
when calling :math
, need ":" before math.
Why?
The colon is used to call an erlang function. So, if you see a function in the erlang docs that you would like to call, then you have to precede the name with a colon. Functions provided by Elixir are not preceded by a colon.
Module names must be atoms.
In elixir, the literal starting with a capital letter is an atom. All domestic elixir modules are named starting with a capital letter.
erlang modules are starting with a small letter, :math
is an atom, math
is not, in elixir. In erlang, math
is already an atom.