Created
February 5, 2014 12:01
-
-
Save kkdai/8822265 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fibinacci(fib_number) | |
return fib_number <= 1 ? 1 : fibinacci(fib_number - 1) + fibinacci(fib_number - 2) | |
end | |
puts fibinacci(1) #output 1 | |
puts fibinacci(3) #output 3 | |
puts fibinacci(5) #output 8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment