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

Abdul Hafiz Abd Rahim
Abdul Hafiz Abd Rahim
6,885 Points

I don't really understand the second task: "Use the greater than or equal to operator and assign the Boolean result.."

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

I do know it has to use ">=" somewhere. And, I know Boolean is either true or false.

All I know is:

"let isGreater = "

operators.swift
// 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

someOperation >= anotherOperation

let result = 200 % 5

// Task 2 - Enter your code below

let isGreater = true

let isPerfectMultiple = result == 0

2 Answers

Abdul Hafiz Abd Rahim
Abdul Hafiz Abd Rahim
6,885 Points

So, operators do act as Boolean too?

Thanks a lot!

Chase Marchione
Chase Marchione
155,055 Points

Hi Abdul,

The challenge is requesting that we use the 'greater than or equal to' operator to compare the values of two constants (someOperation and anotherOperation), and to store the result of the comparison to a boolean constant.

If the comparison is true (meaning that if someOperation is greater than or equal to anotherOperation), the value of isGreater will be true, and if the comparison is false (if someOperation is less than anotherOperation), the value of isGreater will be false.

let isGreater = someOperation >= anotherOperation

Hope this helps!