From: Ryan Leavengood Date: 2005-04-22T07:32:40+09:00 Subject: Re: for .. in .. else? David A. Black wrote: > Hi -- > > How about (untested): > > > > > > <% if song_list.empty? %> > > > > <% else %> > <% for song in song_list %> > > > > <% end %> > <% end %> > >
Songs
no songs!
<%= song.name %>
> > (caMelCaSe method and variable name cleansing at no extra charge :-) > > > David The above works (I tested it) but I think this is more Rubyish: <% if song_list.empty? %> <% else song_list.each do |song|%> <% end %> <% end %>
Songs
no songs!
<%= song.name %>
i.e. get rid of the for entirely. Ryan Leavengood