Top Level Namespace

Instance Method Summary collapse

Instance Method Details

#fib(upper) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/mod_gem.rb', line 4

def fib(upper)
  prev = 0 
  current = 1 
  while (current < upper)
    current = current + prev
    prev = current - prev
  end 
  prev
end