Skip to content

Instantly share code, notes, and snippets.

@katiesmillie
Created August 20, 2015 21:11
Show Gist options
  • Save katiesmillie/8fd311c8acb4cb51bb8a to your computer and use it in GitHub Desktop.
Save katiesmillie/8fd311c8acb4cb51bb8a to your computer and use it in GitHub Desktop.
SwiftCracklePop
func swiftCracklePop() {
var myArray = [String]()
for i in 1...100 {
if i % 5 == 0 && i % 3 == 0 {
myArray.append("CracklePop")
} else if i % 3 == 0 {
myArray.append("Crackle")
} else if i % 5 == 0 {
myArray.append("Pop")
} else {
myArray.append(String(i))
}
println(myArray)
}
}
swiftCracklePop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment