Skip to content

Instantly share code, notes, and snippets.

@joeljackson
Created March 25, 2016 02:24
Show Gist options
  • Select an option

  • Save joeljackson/6a66839c86cfc35aad95 to your computer and use it in GitHub Desktop.

Select an option

Save joeljackson/6a66839c86cfc35aad95 to your computer and use it in GitHub Desktop.
Simple fib in ruby
def fib(num)
return 0 if num == 0
return 1 if num == 1
return fib(num - 1) + fib(num - 2)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment