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 trialNils Garland
18,416 PointsWhat shall i do?
Sorry that i asking that much but what shall i do?
// 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
let isPerfectMultiple = value * divisor
1 Answer
Jennifer Nordell
Treehouse TeacherLet's say for instance that we want to know if a value is even or odd. If you divide three by two what do you get? Answer: 1.5. This means that it is divisible by one with a remainder of one out of two which is the .5 part. So a number modulus 2 can only ever have a result of 1 (which means the remainder is 1 out of 2) or 0 (which means the number is evenly divisible). 4 modulus 2 will have a remainder of 0. 3 modulus 2 will have a remainder of 1. Anything with a remainder of 0 is evenly divisible.
Here, it just wants you to compare result to 0 to see if it was evenly divisible. It's only your last line that's incorrect. Take a look:
let isPerfectMultiple = result == 0
This line simply returns a true or false to isPerfecftMultiple. Was the result equal to 0? Yes? Then the number was evenly divisible (ie it's a perfect multiple of that number). Hope this helps!
Nils Garland
18,416 PointsNils Garland
18,416 PointsThanks, it helps :)