Last active
December 19, 2015 17:38
-
-
Save grejppi/5992313 to your computer and use it in GitHub Desktop.
"99 Bottles of Beer" in Julia
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
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