SHARE
TWEET

Fibonnaci.rb

P22DX May 15th, 2020 1,094 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def fib(num)
  2.     if num < 2
  3.         num
  4.     else
  5.         fib(num - 1) + fib(num - 2)
  6.     end
  7. end
  8.  
  9. for x in 0..8 do
  10.     puts fib(x)
  11. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top