elixir-in-action/chapter3/natural_nums.ex

9 lines
146 B
Elixir
Raw Permalink Normal View History

2020-06-20 13:57:33 -05:00
defmodule NaturalNums do
def print(1), do: IO.puts(1)
def print(n) when is_integer(n) and n > 1 do
print(n - 1)
IO.puts(n)
end
end