Skip to content

Instantly share code, notes, and snippets.

@guilleiguaran
Created February 6, 2015 15:43
Show Gist options
  • Save guilleiguaran/d880d5f7eb9691c793fa to your computer and use it in GitHub Desktop.
Save guilleiguaran/d880d5f7eb9691c793fa to your computer and use it in GitHub Desktop.
defmodule Math do
def factorial(0), do: 1
def factorial(n) when n > 0 do
n * factorial(n - 1)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment