From: Ryan Leavengood Date: 2005-04-23T00:10:48+09:00 Subject: Re: for .. in .. else? Hal Fulton wrote: > >>>> Shouldn't that be "if" instead of "unless"? > > Actually I'm not awake enough atm to judge... but the mere fact > that it generates discussion shows that it's ugly code that I've > written. :) Come on guys, how hard is it to test? :) Using if is correct...to see, run this code: require 'erb' Song = Struct.new("Song", :name) song_list = [Song.new('Shiver'), Song.new('Free'), Song.new('Follow Me')] template =< Songs <% if song_list.each do |song|%> <%= song.name %> <% end.empty? %> no songs! <% end %> END erb = ERB.new(template) puts "With songs:" erb.run song_list=[] puts "Without songs:" erb.run