Why would this code not print anything?

Why would this code not print the the string in the body of the if statement? My apologies, I am a complete beginner to Swift.

x % y == y will never evaluate to true, because y cannot be the remainder that results from division by y. For example, 2000 % 1000 is 0, because 2000 = 2*1000 + 0.

You want itemsSold % 1000 == 0, or even better, itemsSold.isMultiple(of: 1000).

5 Likes

Thank you very much Steve! Really appreciate it.