Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@karlosmid
Last active October 24, 2020 12:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karlosmid/98b079f7227b66ece0c0250a46668b21 to your computer and use it in GitHub Desktop.
Save karlosmid/98b079f7227b66ece0c0250a46668b21 to your computer and use it in GitHub Desktop.
example of using elixir macros
defmodule If do
defmacro if(clause, do: expression) do
quote do
if(unquote(clause) == :true, do: unquote(expression))
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment