From: Reprisal Date: 2006-11-08T03:41:33+09:00 Subject: Re: 99 bottles of beer...pg57 you could drop the unless and the final line. ( num = 1, num-1 = 0 ;) 99.downto( 1 ) do |num| puts puts "#{num} bottles of beer on the wall, #{num} bottles of beer," puts "take one down, pass it around," puts "#{num-1} bottles of beer on the wall" end Altho I think the book hasn't covered the enumeration type stuff yet like downto. On Nov 7, 2006, at 1:15 PM, Phrogz wrote: > Phrogz wrote: >> 99.downto( 1 ) do |num| >> puts "#{num} bottles of beer on the wall, #{num} bottles of beer," >> puts "take one down, pass it around," >> end >> puts '0,Bottles of beer on the wall ;)' > > Oops, I am, of course, missing one line of the song, and a nice > newline > for breaks. Should be more like: > > 99.downto( 1 ) do |num| > puts > puts "#{num} bottles of beer on the wall, #{num} bottles of beer," > puts "take one down, pass it around," > puts "#{num-1} bottles of beer on the wall" unless num == 1 > end > puts '0 bottles of beer on the wall ;)' > >