From: "David A. Black" Date: 2005-04-22T22:21:49+09:00 Subject: Re: for .. in .. else? Hi -- On Fri, 22 Apr 2005, Gavin Kistner wrote: > On Apr 22, 2005, at 6:27 AM, Douglas Livingstone wrote: >> On 4/21/05, Hal Fulton wrote: >>> >>> FWIW I'll offer this (untested) alternative: >>> >>> >>> >>> <% unless song_list.each do |song|%> >>> >>> <% end.empty? %> >>> >>> <% end %> >>> >>>
Songs
<%= song.name %>
no songs!
>>> >>> >> >> Now that is nice :) > > Shouldn't that be "if" instead of "unless"? No. You want to list the song names, unless the list of songs is empty, in which case you just want to say: no songs. (You have to read ahead to the end.empty? bit to see how it all fits together.) David -- David A. Black dblack@wobblini.net