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

Sawyer MacDonald
Sawyer MacDonald
463 Points

I need help and I just need the full answer.

I have no idea what this is and I've tried a lot! I do not understand this at all. Somebody give me the answer I am getting frustrated.

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

value % divisor
let result = value % divisor

let isPerfectMultiple = true


// Task 2 - Enter your code below

someOperation  anotherOperation

let isGreater = someOperation  anotherOperation

1 Answer

andren
andren
28,558 Points

The problem isn't your code so much as it is the symbol you use within it. In swift (and most other languages) the greater than or equal to symbol is this >= not . Those symbols are not interchangeable.

If you replace the symbol with the correct one, and remove your second to last line since it doesn't really do anything like this:

// Task 2 - Enter your code below
let isGreater = someOperation >= anotherOperation

Then your code will work.

Edit:

Also I notice that your solution to Task 1 is slightly off, the isPerfectMultiple constant should not be hard coded to true it should be set to a comparison of result to 0. Like this:

let isPerfectMultiple = result == 0 // Compare if result is equal to 0

That is the code that was intended to be used. It will result in true in this task so your solution will pass regardless, but hardcoding it to true somewhat misses the point of the task.