5 things you need to remember in Elixir
- Single quotes vs double quotes
A lot of modern programming languages, like ruby, javascript and python, will treat'string'
the same as"string"
. In Elixir, however, it is not the case
> 'string' == "string"
false> IEx.Info.info('string')
... {"Data type", "List"} ...> IEx.Info.info("string")
... {"Data type", "BitString"} ...
2. function clause for idiomatic elixir
defmodule AnimalSoundEmitter do
def emit(:dog), do: :bark
def emit(:cat), do: :meow
def…