Skip to content

Instantly share code, notes, and snippets.

@tomcha
Created March 2, 2016 11:16
Show Gist options
  • Select an option

  • Save tomcha/35c7e7bc531d173dd299 to your computer and use it in GitHub Desktop.

Select an option

Save tomcha/35c7e7bc531d173dd299 to your computer and use it in GitHub Desktop.
偽FizzBuzz
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