Skip to content

Instantly share code, notes, and snippets.

@moccos
Last active June 24, 2016 00:12
Show Gist options
  • Save moccos/ee28221890f0b7feab06 to your computer and use it in GitHub Desktop.
Save moccos/ee28221890f0b7feab06 to your computer and use it in GitHub Desktop.
defmodule Hoge do
@flag false
defmacro ifa(a, exp) do
if (Macro.expand_once(a, __CALLER__)), do: exp
end
def main do
if (@flag), do: IO.puts 123
ifa (@flag), do: IO.puts 456
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment