I'm not sure what's going wrong here.
What changes should I make to make this run?
Code Ruby:class Fib def FibUpTo(max) i1,i2 = 1,1 yield i1 <= max return i1 i1, i2 = i2, i1+i2 end end end newobj = Fib.new print newobj.FibUpTo(500)
Btw, why does the code output only "1" when I replace 'yield' with 'while'?![]()




Bookmarks