Last active
January 7, 2020 22:01
-
-
Save kylejohnsonkj/4b0a3a063714fd0257626a17cea1fc12 to your computer and use it in GitHub Desktop.
Shortest variation of FizzBuzz I could come up with
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
for n in 1...100 { | |
var s = "" | |
s += n % 3 == 0 ? "Fizz" : "" | |
s += n % 5 == 0 ? "Buzz" : "" | |
print(s.isEmpty ? n : s) | |
} |
Author
kylejohnsonkj
commented
Jan 7, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment