Skip to content

Instantly share code, notes, and snippets.

@edunham
Created June 1, 2014 01:26
Show Gist options
  • Save edunham/7bfb8914926e248ed87f to your computer and use it in GitHub Desktop.
Save edunham/7bfb8914926e248ed87f to your computer and use it in GitHub Desktop.
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