Skip to content

Instantly share code, notes, and snippets.

@scottmkroberts
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scottmkroberts/ccd15cd72082904292d2 to your computer and use it in GitHub Desktop.
Save scottmkroberts/ccd15cd72082904292d2 to your computer and use it in GitHub Desktop.
Fizz Buzz in Siwft
for i in 1...100{
let divisbleBy3 = i%3
let divisbleBy5 = i%5
if divisbleBy3 == 0 && divisbleBy5 == 0{ // no remainder
println("fizz buzz")
}else if divisbleBy3 == 0{
println("fizz")
}else if divisbleBy5 == 0{
println("buzz")
}else{
println("\(i)")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment