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

I am having a small issue with this task because I thought this is how to do it. Little help?

I can't code for my life.

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
let result = value % divisor
let isPerfectMultiple = result == 0
// Task 2 - Enter your code below
let isGreater = someOperation >_ anotherOperation

2 Answers

andren
andren
28,558 Points

Your code is good, you just have a typo. The greater than or equal to operator is ">=" not ">_" as you have written. If you fix that one issue then your code will pass.

And you shouldn't beat yourself up over minor mistakes like this. Typos are practically unavoidable when you first start out coding, and besides that minor mistake your code is perfect.

Andren I did what you said and it didn't work. look at this code:

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 let isPerfectMultiple = result == 0 // Task 2 - Enter your code below let isGreater = someOperation >_ anotherOperationlet value = 200 let divisor = 5

andren
andren
28,558 Points

It doesn't seems like you have actually replaced ">_" with ">=" like I instructed, the solution looks like this:

// 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
let result = value % divisor
let isPerfectMultiple = result == 0
// Task 2 - Enter your code below
let isGreater = someOperation >= anotherOperation

As you can see it's identical to your first solution with the exception of replacing ">_" in the last line with ">=" which is the correct operator for a greater than or equal operation.