Skip to content

Instantly share code, notes, and snippets.

@afeld
Created November 14, 2011 03:33
Show Gist options
  • Save afeld/1363173 to your computer and use it in GitHub Desktop.
Save afeld/1363173 to your computer and use it in GitHub Desktop.
99 bottles using PDD
# sing "99 bottles of beer on the wall..."
# sing "98 bottles of beer on the wall..."
# ...keep counting down...
# sing "99 bottles of beer on the wall..."
puts "99 bottles of beer on the wall..."
# sing "98 bottles of beer on the wall..."
puts "98 bottles of beer on the wall..."
# ...keep counting down...
# over and over again:
# sing "[however many you have] bottles of beer on the wall..."
# over and over again:
while true do
# sing "[however many you have] bottles of beer on the wall..."
puts "#{number_of_beers} bottles of beer on the wall..."
end # pass it around!
# start at 99
number_of_beers = 99
# over and over again:
while true do
# sing "[however many you have] bottles of beer on the wall..."
puts "#{number_of_beers} bottles of beer on the wall..."
end # pass it around!
# start at 99
number_of_beers = 99
# over and over again:
while true do
# sing "[however many you have] bottles of beer on the wall..."
puts "#{number_of_beers} bottles of beer on the wall..."
# take one down!
number_of_beers = number_of_beers - 1
end # pass it around!
# start at 99
number_of_beers = 99
# over and over again:
while number_of_beers > 0 do # but only while we have beers left!
# sing "[however many you have] bottles of beer on the wall..."
puts "#{number_of_beers} bottles of beer on the wall..."
# take one down!
number_of_beers = number_of_beers - 1
end # pass it around!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment