From: Ron Jeffries Date: 2002-01-14T11:48:36+09:00 Subject: Re: Small Methods - a ramble On Sun, 13 Jan 2002 23:49:36 GMT, David Alan Black wrote: > > > >Are you sure you want to use 'each' as the iterator variable name? >Memories of naming methods 'test' rear their ugly heads.... > > [ [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 > >Well, it works :-) I find it hard to parse visually, though, and >slightly illogical (given the existing role and flavor of the word >'each' in iterator-land). > > Smalltalkers use 'each' for that variable, so that's why we do it. If the variable's type isn't obvious we might call it 'eachFilename" or the like. I don't read enough Ruby code to know if there's a standard thing naming convention for the iteration variable. Is there? Regards, Ronald E Jeffries http://www.XProgramming.com http://www.objectmentor.com I'm giving the best advice I have. You get to decide whether it's true for you.