start to add while loop
This commit is contained in:
13
test/runners/fibo_while.rb
Normal file
13
test/runners/fibo_while.rb
Normal file
@ -0,0 +1,13 @@
|
||||
def fibonaccit(n)
|
||||
a = 0
|
||||
b = 1
|
||||
while n > 1 do
|
||||
tmp = a
|
||||
a = b
|
||||
b = tmp + b
|
||||
puts b
|
||||
n = n - 1
|
||||
end
|
||||
end
|
||||
|
||||
fibonaccit( 10 )
|
Reference in New Issue
Block a user