Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
FrizzBuzz in swift
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