From: tamouse mailing lists Date: 2013-03-26T21:08:41+09:00 Subject: Re: Chris Pine Tutorial 99 Bottles of Beer Program On Tue, Mar 26, 2013 at 2:00 AM, Phil H. wrote: > Hello all, this is what I came up with, works great. > > bottles_of_beer = 99 > while bottles_of_beer > 1 > puts bottles_of_beer.to_s + ' bottles of beer on the wall, ' + > bottles_of_beer.to_s + ' bottles of beer' > bottles_of_beer = bottles_of_beer - 1 > puts 'You take one down, pass it around, ' + bottles_of_beer.to_s + ' > bottles of beer on the wall.' > end > > puts 'Everyone passes out quite drunk.' def beersong(n=99) n.downto(1) do |i| puts < 2 ? i-1 : "no more"} bottles of beer! SONG end puts "... and they all fell down drunk!" end