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 trialdemetri selmer
521 Pointsoperators
not sure how to use the remained operator and the equal operator?
// 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 results : Int = value % divisor
// Task 2 - Enter your code below
let isPerfectMultiple : Int = results != 0
2 Answers
james south
Front End Web Development Techdegree Graduate 33,271 Pointsyou basically have it, on step two check for equality with == .
Michael Afanasiev
Courses Plus Student 15,596 PointsHi Demetri,
If you used the == you WILL get an error because you explicitly specified your constants to be of type Int (Also, there is no need to do that for this challenge.) and it cannot evaluate constants of type Bool.
Your code should basically look like so:
// this evaluates to 0 because 5 can be equally divided in 200
let results = value % divisor
// checks if the result constant is equal to 0, means no remainder! ?
let isPerfectMultiple = result == 0
Hope this helps! Now go on to task number ✌️!
demetri selmer
521 Pointsdemetri selmer
521 Pointsi did that and got this bummer Make sure that the value assigned to result is an operation using the remainder operator and not simply an Int value!