garde d'élixir

defmodule SomeModule do
  defguard greater_than_five_less_than_nine_number(x) when x > 5 and x < 9

  @doc """
      iex> SomeModule.do_something(6)
      "It's greater than 5 and less than 9!"

      iex> SomeModule.do_something(3)
      "Not in the range :("
  """
  def do_something(num) when greater_than_five_less_than_nine_number(num) do
    "It's greater than 5 and less than 9!"
  end

  def do_something(_num) do
    "Not in the range :("
  end
end
Uncommon Nightingale