Answers for "elixir fibonacci"

0

elixir fibonacci

defmodule Fib do 
  def fib(0) do 0 end
  def fib(1) do 1 end
  def fib(n) do fib(n-1) + fib(n-2) end
end

IO.puts Fib.fib(10)
Posted by: Guest on January-09-2022

Browse Popular Code Answers by Language