Skip to content

Instantly share code, notes, and snippets.

@agconti
Created December 14, 2015 00:22
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 agconti/07d470ea3e33b9c86ddc to your computer and use it in GitHub Desktop.
Save agconti/07d470ea3e33b9c86ddc to your computer and use it in GitHub Desktop.
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