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 trial

iOS Swift 2.0 Basics Swift Operators Working With Operators

operation

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 0==0 let isPerfectMultiple = true

//Use the greater than or equal to operator and assign the Boolean result of the comparison to a constant named isGreater.

*the code below won't run what is the solution?

someOperation>=anotherOperation

let isGreater = false

1 Answer

Steven Deutsch
Steven Deutsch
21,046 Points

Hey G Deng,

The code challenge asks us to check if someOperation is greater than or equal to anotherOperation. We can do this using the greater than or equal to operator ( >= ). Then we are asked to set the result of this comparison (the result will be a Boolean of value of either true or false) to a constant called isGreater.

let isGreater = someOperation >= anotherOperation

Since someOperation is not greater or equal to anotherOperation, the comparison will return a Bool value of false. The isGreater constant will then be set to the returned Bool value.

Hope I've helped, good luck!

thanks a lot Steve, this help