"Fear Dubh" <feardubh / spam.spam> writes: > Hello, > > Is there a difference between: > for foo in bar do ... > and > bar.each do |foo| ... > > or is it just a question of style? > I prefer the look of "for ... do ...", > > but I mostly see each in the samples posted by the Ruby > wizards on the NG. > > Thanks I strongly prefer #each over for, because it is more consistent and doesn't hide the fact that there really is a method call to #each. I think I could agree to use for in rake and ERB (though I don't use ERB at all), because it may have "cleaner" look for a DSL. For standard Ruby code, use #each just like everyone else :-). -- Christian Neukirchen <chneukirchen / gmail.com> http://chneukirchen.org