Skip to content

Instantly share code, notes, and snippets.

@antoncohen
Created September 6, 2011 01:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antoncohen/1196354 to your computer and use it in GitHub Desktop.
Save antoncohen/1196354 to your computer and use it in GitHub Desktop.
99 Bottles of Beer in CoffeeScript
#!/usr/bin/env coffee
print = (line) -> process.stdout.write line + '\n'
for num in [99..1]
if num > 1
print "#{num} bottles of beer on the wall, #{num} bottles of beer."
if num-1 > 1
print "Take one down and pass it around, #{num-1} bottles of beer on the wall.\n"
else
print "Take one down and pass it around, #{num-1} bottle of beer on the wall.\n"
else
print "#{num} bottle of beer on the wall, #{num} bottle of beer."
print "Take one down and pass it around, no more bottles of beer on the wall.\n"
print """No more bottles of beer on the wall, no more bottles of beer.
Go to the store and buy some more, 99 bottles of beer on the wall."""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment