Skip to content

Instantly share code, notes, and snippets.

@grejppi
Last active December 19, 2015 17:38
Show Gist options
  • Save grejppi/5992313 to your computer and use it in GitHub Desktop.
Save grejppi/5992313 to your computer and use it in GitHub Desktop.
"99 Bottles of Beer" in Julia
bottles(n) = "$n bottle" * "s"^(n != 1 ? 1 : 0) * " of beer"
song(n) = "
$(bottles(n)) on the wall,
$(bottles(n)),
" * (n > 0 ? "Take one down, pass it around,
$(bottles(n-1)) on the wall.
$(song(n-1))" : "Go to the store and buy some more,
$(bottles(99)) on the wall.
")
println(song(99))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment