Created
March 2, 2016 11:16
-
-
Save tomcha/35c7e7bc531d173dd299 to your computer and use it in GitHub Desktop.
偽FizzBuzz
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
| import Foundation | |
| for i in (1...100){ | |
| var str : String = "" | |
| var randThree = arc4random_uniform(3) | |
| var randFive = arc4random_uniform(5) | |
| if (randThree == 0){ | |
| str = "Fizz" | |
| } | |
| if (randFive == 0){ | |
| str += "Buzz" | |
| } | |
| if (str == ""){ | |
| str = "\(i)" | |
| } | |
| print(str) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment