On Tue, Aug 26, 2008 at 6:30 PM, danielj <sleepingindian / gmail.com> wrote:
> Just a beginner with a question about this:
>
> <i>=95 "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."</i>
>
> This is what I came up with:
>
> bottles =3D 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 =3D (bottles-1)
>
> end
>
> Is this ok?
>
> Are there faster or better ways?

Have a look at the #downto method.

hth a little,
Todd