Hey, I personally use .each, but if you're looking to squeeze every bit of performance from your app, use for, as it's about 7% faster than .each.
http://rubybenchmark.com/reports/12 Regards Kieran On Aug 5, 1:26 am, Pale Horse <[email protected]> wrote: > When looping through arrays. What'd you argue to be good (or best) > practice? > > <% for something in @lots_of_things %> > <%= something.name %> > <% end %> > > <% @lots_of_things.each do |something| %> > <%= something.name %> > <% end %> > > I've read mixed opinions on this small topic. Some say that FOR loops > are easier, though I cannot see how. Others say that EACH is a more > 'railsy' method... > > Personally, I tend to use EACH as I was taught this to be correct and > follow this rule to retain consistency in MY code. What is your opinion > on this? > -- > Posted viahttp://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

