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 trialMichael Sarpong
478 Pointsassign results to a constant isGreate than
let value = 200 let divisor = 5
let someOperation = 20 + 400 % 10 / 2 - 15 let anotherOperation = 52 * 27 % 200 / 2 + 5
let result: Int = value % divisor
let isPerfectMultiple = result == 0
let comparison = "someOperation" > "anotherOperation"
let isGreater = true
// Enter your code below
let value = 200
let divisor = 5
let someOperation = 20 + 400 % 10 / 2 - 15
let anotherOperation = 52 * 27 % 200 / 2 + 5
let result: Int = value % divisor
let isPerfectMultiple = result == 0
let comparison = "someOperation" > "anotherOperation"
let isGreater = true
1 Answer
Kyle Johnson
33,528 PointsUse the greater than or equal to operator and assign the Boolean result of the comparison to a constant named isGreater
.
The Code Challenge is asking you to use the greater than or equal to operator. You are only using the greater than operator. You can actually write the code like below to achieve the solution. You also do not want to put quotes around the constants, someOperation
and anotherOperation
. This is comparing two(2) Strings, not the constants.
let isGreater: Bool = someOperation >= anotherOperation
Michael Sarpong
478 PointsMichael Sarpong
478 PointsNot quite sure how i assign the results of comparison to "isGreater"
or even where to find the greater than or equal to on a mac. when i paste it from the web its not recognised