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 trialMazen Wasel
1,153 Points"Comparethe valueof resultto 0 using the equalityoperator andassign the resultingvalue to a constant named isPerfect"???
"Compare the value of result to 0 using the equality operator and assign the resulting value to a constant named isPerfectMultiple."
how is this done?
the following is what i have:
result == 0
// 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 code below
let result = value % divisor
// Task 2 - Enter your code below
result == 0
2 Answers
jcorum
71,830 PointsMazen, yes, sometimes it's hard to see what's wanted. Try this:
// Task 1 - Enter your code below
let result = value % divisor
// Task 2 - Enter your code below
let isPerfectMultiple = result == 0
let isGreater = someOperation >= anotherOperation
Here result == 0 is the same as value % divisor == 0. If the remainder of the division is 0, the result will be 0, and 0 == 0 will be true. The challenge wants you to assign the result back to the Bool isGreater
David Kisch
659 PointsAm I going mad or is this question way too advanced for the point at which it's asked?!
Mazen Wasel
1,153 PointsMazen Wasel
1,153 PointsThank you Jcorum.
I had it all along I just forgot to use "let" when declaring the "isPerfectMultiple"!