Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialVinod Nambiar
Courses Plus Student 14,849 PointsStep 2: When value obtained using a remainder operator is 0, this means that the value is a perfect multiple of the divi
Step 2: When value obtained using a remainder operator is 0, this means that the value is a perfect multiple of the divisor. Compare the value of result to 0 using the equality operator and assign the resulting value to a constant named isPerfectMultiple.
// Enter your code below
let value = 200
let divisor = 5
let someOperation = 20 + 400 % 10 / 2 - 15
let anotherOperation = 52 * 27 % 200 / 2 + 5
// Task 1 - Enter your cde below
let resuint = 0
let isPerfectMultiple = 0
result == isPerfectMultiple
// Task 2 - Enter your code below
1 Answer
Shay Paustovsky
4,281 PointsHi Vinod,
I've just finished this section of the iOS course and I have the solution to your problem. instead of assigning the value of "0" to isPerfectMultiple , and do not assign "0" to result immediatley after creation. rather set it's value to the result of the following operation - value % divisor
Should look like this :
let result: Int = value % divisor
for the 2nd Task :
let isPerfectMultiple: Bool = (result == 0) - basically checking equality using "==" the equals operator
! note - do not confuse "=" with "==" (or rather "=" assignment operator)
! note - I have used explicit typing when declaring variables , it's up to you to choose how to do it.
Best Regards , Shay Paustovsky
Mickey Asavanant
8,237 PointsMickey Asavanant
8,237 PointsI have the same question as well. This question does not much sense.