From: Lloyd Linklater Date: 2008-03-24T23:41:30+09:00 Subject: Re: Beginner's question Peter Johnsson wrote: > bottles = 99 > > while bottles != 0 > # Need help here. > end My $0.02: bottles = 99 bob = " bottles of beer " otw = "on the wall." while bottles != 0 do puts bottles.to_s + bob + otw puts bottles.to_s + bob puts "Take one down and pass it around" bottles -= 1 puts bottles.to_s + bob + otw puts "" end Here is a way to do it with an implicit decrementor: bob = " bottles of beer " otw = "on the wall." 99.downto(1) do |bottles| puts bottles.to_s + bob + otw puts bottles.to_s + bob puts "Take one down and pass it around" puts (bottles - 1).to_s + bob + otw puts "" end -- Posted via http://www.ruby-forum.com/.