Last active
August 29, 2015 14:02
-
-
Save scottmkroberts/ccd15cd72082904292d2 to your computer and use it in GitHub Desktop.
Fizz Buzz in Siwft
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
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