Skip to content

Instantly share code, notes, and snippets.

@parroty
Last active December 22, 2015 02:48
Show Gist options
  • Select an option

  • Save parroty/6405497 to your computer and use it in GitHub Desktop.

Select an option

Save parroty/6405497 to your computer and use it in GitHub Desktop.
Fibonacci number
defmodule Sequence do
def fib(0), do: 1
def fib(1), do: 1
def fib(n), do: fib(n - 1) + fib(n - 2)
end
IO.puts Sequence.fib(10) # -> 89
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment