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 trialMarcel van Leeuwen
2,629 PointsOperators challenge 2/2
Hi,
I'm stuck with Operators challenge 2/2. I'm not sure how to assign the bool value to the constant "isGreater". Please some help.
// 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
let isPerfectMultiple = result == 0
// Task 2 - Enter your code below
someOperation >= anotherOperation
someOperation <= anotherOperation
let isGreater =
2 Answers
Anonymous User
Courses Plus Student 2,204 PointsYeah, this question is explained and set out weird.
let value: Int = 200 let divisor: Int = 5
let someOperation: Int = 20 + 400 % 10 / 2 - 15 let anotherOperation: Int = 52 * 27 % 200 / 2 + 5
let result: Int = value % divisor let isPerfectMultiple: Bool = result == 0
let isGreater: Bool = someOperation >= anotherOperation
hope this helps. I can't really explain it, as i just scraped through
Marcel van Leeuwen
2,629 PointsHi Anonymous User,
Thanks for the help!
I find this question confusing but on the other hand I'll find the answer clear. Maybe it's beter to set the types like you do.
Anonymous User
Courses Plus Student 2,204 PointsYeah, i find its a good habit to get into, especially when you have to start doing it in structs, functions and classes, where the compiler can't figure out what the type by itself, because hard coding the values doesn't work