module Fib
Constants
- VERSION
Public Instance Methods
number(n)
click to toggle source
# File lib/fib.rb, line 6 def number(n) (0..n-2).reduce([0,1]) do |acc, n| acc = [acc.last, acc.sum] end.last end
# File lib/fib.rb, line 6 def number(n) (0..n-2).reduce([0,1]) do |acc, n| acc = [acc.last, acc.sum] end.last end