From: Todd Benson Date: 2008-08-27T09:28:54+09:00 Subject: Re: Chris Pine Tutorial 99 Bottles of Beer Program On Tue, Aug 26, 2008 at 6:30 PM, danielj wrote: > Just a beginner with a question about this: > > • "99 bottles of beer on the wall..." Write a program which prints > out the lyrics to that beloved classic, that field-trip favorite: "99 > Bottles of Beer on the Wall." > > This is what I came up with: > > bottles = 100 > > while bottles > 1 > > puts (bottles-1).to_s + " Bottles of beer on the wall, " + > (bottles-1).to_s + " Bottles of beer! You take one down, you pass it > around and " + (bottles-2).to_s + " Bottles of beer on the wall!" > > bottles = (bottles-1) > > end > > Is this ok? > > Are there faster or better ways? Have a look at the #downto method. hth a little, Todd