Pale Horse 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...

Not Railsy so much as Rubyish.

> 
> 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?

I do likewise.  To tell you the truth, I don't even remember that the 
for construct exists until I see it in other people's code.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
-- 
Posted via http://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.

Reply via email to