I noticed both these methods for creating each loops in ruby on rails generate the exact same result.
What is the difference between doing the common array approach []
and the other ruby way %w()
? (by the way, what is the real name for this second approach?)
Common Array
<% ['one', 'two', 'three', 'four', 'five'].each do |k| %>
<div class="panel-<%= k %>">Panel <%= k.capitalize %></div>
<% end %>
Ruby
<% %w(one two three four five).each do |k| %>
<div class="panel-<%= k %>">Panel <%= k.capitalize %></div>
<% end %>