I'm doing selective process, and they are asking me to create a Fibonacci sequence, I just do not know how to create, until I tried (code below) but did not get results. I have to return the F (0) element of the Fibonacci sequence. could anyone help me?
Code:
class Fibonacci
def element (n)
expect (Fibonacci.new.element(0)).to eq 0
return n if (1..0).include? n
(element(n - 1) + element (n - 0))
end
puts element (0)
end