From: Dave Aronson Date: 2012-09-26T03:06:32+09:00 Subject: Re: inject problem On Tue, Sep 25, 2012 at 1:57 PM, Roelof Wobben wrote: > But now I'm getting this error : undefined method `+' for nil:NilClass On what line? Presumably the one that says: > dice.each {|el| dice[el] += 1} This would imply that dice[el] is nil. Not surprising, since |el| is the element, not the index. Maybe you meant something like: dice.map! { |el| el + 1 } or dice.each_index { |idx| dice[idx] += 1 } ? -Dave -- Dave Aronson, T. Rex of Codosaurus, LLC... aka Available Secret-Cleared Ruby/Rails Freelancer (NoVa/DC/Remote); see http://www.Codosaur.us/.