On Wed, Jan 11, 2012 at 06:07, Ahmy Yulrizka <[email protected]> wrote:
> simple solution is > > change it to : > > var_i * (numb_i || 0) Even simpler solution is to initialize the variable first. But with that approach, you should do them all -- the current solution will barf on the first digit past the one that the number is a multiple of. (That is, if you feed it 30, it will barf due to var_v being nil; if you feed it 150, it'll barf due to num_x being nil, etc.) Another one would be to just output the needed digits immediately, rather than stashing the number of them and outputting them later. -Dave -- Dave Aronson, President, Dave Aronson Software Engineering and Training Ruby on Rails Freelancing (Northern Virginia, Washington DC, or Remote) DaveAronson.com, Codosaur.us, Dare2XL.com, & RecruitingRants.com (NEW!) Specialization is for insects. (Heinlein) - Have Pun, Will Babble! (me) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

