credit: Elixir in Action by Saša Jurić from chapter 1
S
S
S
W
W
W
W
W
W
def defmacro case cond defmodule defp defstruct ...
Credit: www.elixirschool.com
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"
Image credit : http://learnyousomeerlang.com/what-is-otp
Image credit : https://elixirforum.com/u/romariolopezc/