|
Re: `+': Range can't be coerced into Fixnum (TypeError): msg#02405ruby-talk
On Fri, 31 Jul 2009 13:07:33 +0900, Prateek Agarwal wrote: > I am getting the follower > `+': Range can't be coerced into Fixnum (TypeError) > > How to get rid of this? > > Attachments: > http://www.ruby-forum.com/attachment/3915/Question5.rb def checkforcube(rem) if (rem<0) return 0 end for i in 1..rem if (rem==(i**3)) return 1 end end puts "shouldn't get here" end #rest of the program as normal output: shouldn't get here /tmp/v84078/ruby1.rb:20:in `+': nil can't be coerced into Fixnum (TypeError) from /tmp/v84078/ruby1.rb:20 from /tmp/v84078/ruby1.rb:17:in `each' from /tmp/v84078/ruby1.rb:17 from /tmp/v84078/ruby1.rb:15:in `loop' from /tmp/v84078/ruby1.rb:15 -- Chanoch (Ken) Bloom. PhD candidate. Linguistic Cognition Laboratory. Department of Computer Science. Illinois Institute of Technology. http://www.iit.edu/~kbloom1/
|
|
||||||||||||||||||||||||||
| News | Mail Home | sitemap | FAQ | advertise |