Created
November 13, 2022 23:03
-
-
Save EvolvingParty/b2d4fb433d7a25cff09ec330905cd08a to your computer and use it in GitHub Desktop.
100 Days of SwiftUI! DAY 6
This file contains 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
import Cocoa | |
///Your goal is to loop from 1 through 100, and for each number: | |
///If it’s a multiple of 3, print “Fizz” | |
///If it’s a multiple of 5, print “Buzz” | |
///If it’s a multiple of 3 and 5, print “FizzBuzz” | |
///Otherwise, just print the number. | |
for i in 1...100 { | |
if i.isMultiple(of:3) && i.isMultiple(of:5) { | |
print("FizzBuzz") | |
} else if i.isMultiple(of:3) { | |
print("Fizz") | |
} else if i.isMultiple(of:5) { | |
print("Buzz") | |
} else { | |
print("\(i)") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment