Skip to content

Instantly share code, notes, and snippets.

@Clokze
Created June 16, 2015 13:54
Show Gist options
  • Select an option

  • Save Clokze/fdf37387536a519b7260 to your computer and use it in GitHub Desktop.

Select an option

Save Clokze/fdf37387536a519b7260 to your computer and use it in GitHub Desktop.
defmodule Math do
def fibonnaci(n, prev \\ 0, current \\ 1)
def fibonnaci(n, _prev, current) when n < 1 do
IO.puts(current)
end
def fibonnaci(n, prev, current) do
fibonnaci(n - 1, current, current + prev)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment