Pierre wants to know if he gets credit:
Is my solution as good, or is Paul's solution more efficient, and why ?
Welcome to Checkpoint 3!
Your solution works, so as @Suzanne points out, That's Great!
Are there better solutions to this Challenge? Sure, but you've not learned all the tricks yet. You haven't explored other coding techniques, nor have you gained the experience to rethink solutions. This will come with practice.
I'll share a few observations, but please don't worry that you didn't code this as tightly as possible. You're still learning.
You wrote:
if i % 3 == 0 && i % 5 != 0 { // Yikes! what's all this robot / maths syntax?!
print("Fizz")
}
To me, this looks like you've coded in C++, or perhaps JAVA. This code reeks of math formulae. You almost need an advanced education in maths symbols to understand this. Indeed, there's a more Swifty way to code the same thing.
// This solution is more Swifty, easier to read...
if i.isMultiple(of: 3) {
print("Fizz") // only print if i can be divided evenly by 3
}
Also, if you put the test for FizzBuzz first (multiple of 3 AND a multiple of 5), convince yourself that the other two cases only have to determine if your number is a multiple of three, or of five.
So, with a couple of changes to your code, you can make it shorter (fewer comparisons) and easier to read.
Keep Coding!