From: Tobias Reif Date: 2002-01-14T18:11:50+09:00 Subject: Re: Small Methods - a ramble Ron Jeffries wrote: >> [ [1,2], [3,4] ].each {|each| each.each {|each| p each}} >> > > Yes, well, I wouldn't do that, and especially wouldn't use each in two nested loops ... > > I'd at least do this: > [ [1,2], [3,4] ].each {|eachArray| eachArray.each {|eachInteger| p eachInteger}} > > and more likely: > > [ [1,2], [3,4] ].each do|eachArray| > eachArray.each do |eachInteger| > p eachInteger > end > end Hmmm. I dub groups with plural names, and single items with singular names. integer_pair_arrays = [ [1,2], [3,4] ] integer_pair_arrays.each do |pairs_array| pairs_array.each do |integer| p integer end end If I take one cup out of ten, I call it "cup", not "each_cup". Tobi -- http://www.pinkjuice.com/