Skip to content

Instantly share code, notes, and snippets.

@imjhk03
Created May 27, 2025 02:03
Show Gist options
  • Select an option

  • Save imjhk03/6214ac2a08b1291fe9e6aa0aaeeda105 to your computer and use it in GitHub Desktop.

Select an option

Save imjhk03/6214ac2a08b1291fe9e6aa0aaeeda105 to your computer and use it in GitHub Desktop.
Swift version of FizzBuzz loop
(1...100).forEach { num in
switch (num.isMultiple(of: 3), num.isMultiple(of: 5)) {
case (true, true): print("FizzBuzz")
case (true, false): print("Fizz")
case (false, true): print("Buzz")
default: print(num)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment