From: Vladimir Date: 2012-04-04T21:36:34+09:00 Subject: Re: Newbie loops question On 04/04/2012 02:26 PM, Bryan Bales wrote: > I am learning Ruby as my first programming language using the excellent > tutorial by Chris Pine http://pine.fm/LearnToProgram/ > > Everything was going well until I tried to write a simple program to > print out the 99 bottles of beer on the wall song. Here is my code. > > int = 99 > while int != 1 > puts int.to_s + ' bottles of beer on the wall, ' + int.to_s + ' > bottles of beer' > int.to_i - 1 > puts 'Take one down, pass it around, '+int.to_s + ' bottles of beer on > the wall' > end > > When I run this, I get into a loop of 99. It never subtracts one. I have > figured out all the other programs that you are to try, but for some > reason the problem in this is escaping me. Any help will be greatly > appreciated. > > Thanks. > like for me int.to_i - 1 does operation but do not handle result try: int = int -1