Code Golf: 99 Bottles of Beer

Jan 12, 2007

Here is my submission for the 99 Bottles of Beer challenge. Code size: 242 bytes.

a=' bottles of beer'
b=' on the wall'
d=a.tr 's',''
puts e+f+b+', '+e+f+'.'
puts 'Take one down and pass it around, '+(x-1).to_s+(x<3?d:f)+b+".\n\n"if x>1}
puts "Go to the store and buy some more, 99#{a+b}."

Tagged: rubycode golf