D
danielj
Just a beginner with a question about this:
<i>• "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 = 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?
Thanks.
<i>• "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 = 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?
Thanks.