Skip to content

Instantly share code, notes, and snippets.

@edunham
Created June 1, 2014 01:34
Show Gist options
  • Save edunham/af36d34be4fc9fde250f to your computer and use it in GitHub Desktop.
Save edunham/af36d34be4fc9fde250f to your computer and use it in GitHub Desktop.
def bottles(n):
var foo := ""
switch (n) {
match == 0 { foo += "No bottles" }
match == 1 { foo += "1 bottle" }
#match < 3 { foo += "not many"}
match _ { foo += `$n bottles` }
}
return foo
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