From: Rob Biedenharn Date: 2013-03-28T13:20:43+09:00 Subject: Re: 99 Bottle of Beer program On Mar 28, 2013, at 12:12 AM, Vincent Stowbunenko wrote: > See attached for the source code. This program works fine, just except > one thing. At the last lines, it looks like this: > > ... > 2 bottles of beer on the wall, 2 bottles of beer. > Take one down, pass it around, 1 bottles of beer on the wall. > 1 bottle of beer on the wall, 1 bottle of beer. > If that one bottle should happen to fall, what a waste of alcohol! > Take one down, pass it around, no more bottles of beer on the wall. > No more bottles of beer on the wall, no more bottles of beer. > Go to the store and buy some more, 99 bottles of beer on the wall. > > I used #{s} to add "s" if bottles are more than one. But on that 2nd > line, it doesn't seem to remove the "s" from the bottle word, even the > number_of_bottles equals to 1 (or is it?). Can anyone explain why? You set s once *outside* the loop. > > Attachments: > http://www.ruby-forum.com/attachment/8272/bottlesofbeer.rb > > > -- > Posted via http://www.ruby-forum.com/. >