From: "Jan E." Date: 2012-09-26T03:26:55+09:00 Subject: Re: inject problem Roelof Wobben wrote in post #1077503: > h = Hash.new(0) > dice.each {|el| dice[el] += 1} > [...] > But now I'm getting this error : undefined method `+' for nil:NilClass You want h[el] += 1, not dice[el] += 1. See the original code by Jesús. -- Posted via http://www.ruby-forum.com/.