small medium large xlarge

Generic-user-small
18 Jul 2016, 12:56
Benjamin NGUYEN (2 posts)

Hi everyone ! This is my first macro :) Here I use case but cond should works as well

  defmacro unless(expression, do: block) do
    quote do
      case !unquote(expression) do
        x when x in [false,nil] -> nil
        _ -> unquote(block)
      end
    end
  end
You must be logged in to comment