From: Dave Thomas Date: 2001-07-19T22:06:15+09:00 Subject: [ruby-talk:18114] Re: 99 bottles of beer grady@xcf.berkeley.edu (Steven Grady) writes: > (I believe in Perl circles this is called Golf. This is the first > thread I've seen of Ruby Golf..) Fore! > > 174 bytes: > > def b(n) "#{n>0?n: 'No more'} bottle#{n!=1?'s': ''} of beer";end > 99.downto(1){|n|w=" on the wall";puts "#{b(n)}#{w}, #{b(n)}\nTake one down, pass > it around\n#{b(n-1)}#{w}."} Nothing clever, just a bit of tuning.. 171 characters: b=proc{|n|"#{n>0?n: 'No more'} bottle#{n!=1?'s': ''} of beer"} w=" on the wall" 99.downto(1){|n|puts "#{b[n]}#{w}, #{b[n]}\nTake one down, pass it around\n#{b[n-1]}#{w}."} Dave