Created
December 14, 2015 00:22
-
-
Save agconti/07d470ea3e33b9c86ddc to your computer and use it in GitHub Desktop.
FrizzBuzz in swift
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
func frizzBuzz(range:Int) -> Void { | |
for num in 1..<range { | |
var output:String = ""; | |
if num % 3 == 0 { | |
output = "frizz"; | |
} | |
if num % 5 == 0 { | |
output += "buzz"; | |
} | |
print(String(num) + " :" + output); | |
} | |
} | |
frizzBuzz(20); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment