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 Basics Swift Operators Working With Operators

Michael Sarpong
Michael Sarpong
478 Points

assign 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

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

let result: Int = value % divisor

let isPerfectMultiple = result == 0

let comparison = "someOperation" > "anotherOperation"

let isGreater = true
Michael Sarpong
Michael Sarpong
478 Points

Not 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

1 Answer

Kyle Johnson
Kyle Johnson
33,528 Points

Use 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