From: "Jan E." Date: 2012-09-26T05:51:29+09:00 Subject: Re: inject problem You're iterating over the wrong object. After you've build the hash, you have to iterate over this hash and not the dices arrays again. The dices array contains only the numbers. The h hash contains the numbers and corresponding counts. So it's not dice.each {|number, count| ... but h.each {|number, count| ... Since there have been quite some errors now, you should be more careful with the code you write. And you should get used to testing and debugging code yourself. The error message is telling you that the ">" operator has been applied to nil (namely the "count" variable). So if you didn't already know the problem, the first step would be to check why "count" is nil. You'd do this by outputting "dice", since that's what you're iterating over. And then you'd probably realized that it's the completely wrong object. -- Posted via http://www.ruby-forum.com/.