ugh (slap head) it was
n = arg.to_s.to_i so nasty...:) Marco Marco Kotrotsos wrote: > i'm sorry, another one popped up and I hope you can help me with it > > it's with this example > > class Plotlight > def fib n > if n<2 > n > else > res = fib(n-2)+fib(n-1) > end > end > end > > > when executing, I get Object must be of type String. I suspect this to > be because I am feeding it a String argument. When I do this > > class Plotlight > def fib arg > n = arg.to_i > if n<2 > n > else > res = fib(n-2)+fib(n-1) > end > end > end > > it now says > > + $exception {"undefined method `to_i' for 12:ClrString"} > System.Exception {System.MissingMethodException} > > > so it again must be because it's not an expected Integer...but how do I > work around this one? I am trying to understand how this works. > > Thanks > Marco > > > -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core