Created
August 21, 2016 06:11
-
-
Save kironroy/6cf56dc7df9b8b7c6e006aeb7a24f6eb to your computer and use it in GitHub Desktop.
def fib
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 fib(first_num, second_num) | |
limit = 11 | |
while second_num < limit | |
sum = first_num + second_num | |
first_num = second_num | |
second_num = sum | |
end | |
sum | |
end | |
result = fib(0, 1) | |
puts "result is #{result}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment