From: Dat Nguyen Date: 2001-07-19T07:30:10+09:00 Subject: [ruby-talk:18073] 99 bottles of beer

# How to shorten the following experimental codes?

bottle = ' bottles'
99.downto(1) { |i|
    print "\n", i, bottle, ' of beer on the wall, ', i, bottle, ' of beer', ".\n"
    print 'Take one down, pass it around,', "\n"
    bottle = ' bottle' if i == 2
    print i-1, bottle, ' of beer on the wall.', "\n" if i > 1
}
print 'No bottles of beer on the wall.', "\n\n"

# Thanks

# Dat



Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.