Created
June 1, 2014 01:26
-
-
Save edunham/7bfb8914926e248ed87f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def bottles(n): | |
return switch (n) { | |
match ==0 { return "No bottles" } | |
match ==1 { return "1 bottle" } | |
match _ { return `$n bottles` } | |
} | |
var n := 99 | |
while (n > 0): | |
traceln(`${bottles(n)} of beer on the wall, | |
${bottles(n)} of beer. | |
Take one down, pass it around,`) | |
n := n - 1 | |
traceln(`${bottles(n)} of beer on the wall. | |
`) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment