Calculates the n-th Fibonacci number iteratively.
Ali Hamdi Ali Fadel · @AliOsm · about 3 years
Calculates the n-th Fibonacci number iteratively.
def nth_fibonacci(n)n -= 2# suppose that fibonacci is starts with 0, 1a, b = 0, 1n.times { a, b = b, a + b }bend