Created
October 7, 2015 15:18
-
-
Save JessyCatterwaul/2822c29c3b4ba7b8157b to your computer and use it in GitHub Desktop.
Simple wins this round. forEach doesn't help with anything except obfuscation.
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 π’ in 1...100{print([3:"Fi",5:"Bu"].reduce(nil){π’%$1.0==0 ?$1.1+"zz"+($0 ?? ""):$0} ?? π’)} //93 | |
for π’ in 1...100{print(π’%15==0 ?"FizzBuzz":π’%3==0 ?"Fizz":π’%5==0 ?"Buzz":"\(π’)")} //81 | |
(1...100).forEach{print($0%15==0 ?"FizzBuzz":$0%3==0 ?"Fizz":$0%5==0 ?"Buzz":"\($0)")} //86 |
No! Can you? I think the smallest number I've seen was 59, but I haven't seen anyone else do it in Swift.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Do you think with some effort you could get it under 50?