def defmacro case cond defmodule defp defstruct ...
quote
unquote
Credit: www.elixirschool.com
Macros
credit: www.elixirschool.com
defmodule OurMacro do
defmacro unless(expr, do: block) do
quote do
if !unquote(expr), do: unquote(block)
end
end
end
iex> require OurMacro
nil
iex> OurMacro.unless true, do: "Hi"
nil
iex> OurMacro.unless false, do: "Hi"
"Hi"