Skip to content

Instantly share code, notes, and snippets.

@amscotti
Created September 29, 2013 02:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amscotti/6748683 to your computer and use it in GitHub Desktop.
Save amscotti/6748683 to your computer and use it in GitHub Desktop.
Example of pattern matching in Elixir
defmodule Factorial do
def of(0), do: 1
def of(n), do: n * of(n-1)
end
IO.inspect Factorial.of(4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment