Last active
December 3, 2015 00:22
-
-
Save hatzka-nezumi/eb9891734bb7fbe719ed to your computer and use it in GitHub Desktop.
99 bottles of beer in Julia.
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
# 99 bottles of beer in Julia | |
# [email protected] - Creative Commons Zero or Unlicense | |
bottles = 99 | |
s = "s" | |
while bottles > 0 | |
println("$bottles bottle$s of beer on the wall,") | |
println("$bottles bottle$s of beer.") | |
println("Take one down, pass it around,") | |
bottles -= 1 | |
s = bottles > 1 ? "s" : "" # used to adapt plurals | |
if bottles == 0 | |
println("No more bottles of beer on the wall.") | |
else | |
println("$bottles bottle$s of beer on the wall.") | |
end | |
println() | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment