Created
May 27, 2025 02:03
-
-
Save imjhk03/6214ac2a08b1291fe9e6aa0aaeeda105 to your computer and use it in GitHub Desktop.
Swift version of FizzBuzz loop
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
| (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