Skip to content

Instantly share code, notes, and snippets.

@coryschires
Created May 7, 2012 20:16
Show Gist options
  • Save coryschires/2630121 to your computer and use it in GitHub Desktop.
Save coryschires/2630121 to your computer and use it in GitHub Desktop.
Bottle of beer examples
bottle_num = 100
# You can clean up the the puts statement using interpolation (i.e. "Some words #{a_variable} and more words")
#
while bottle_num > 0
puts "#{bottle_num -= 1} bottles of beer on the wall"
end
# Or you could even one line it.
#
puts "#{bottle_num -= 1} bottles of beer on the wall" until bottle_num.zero?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment