Created
September 6, 2011 01:48
-
-
Save antoncohen/1196354 to your computer and use it in GitHub Desktop.
99 Bottles of Beer in CoffeeScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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