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

nvm I need help with this one please help

Jason please give me a hint I really need help thx for your time everyone

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 = 15 % 5
// Task 2 - Enter your code below
let isPerfectMultiple = 3 > 0

let isGreater = "\(someOperation) true"

1 Answer

Garrett Votaw
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Garrett Votaw
iOS Development Techdegree Graduate 15,223 Points

Hi Rico,

isPerfectMultiple should be using the equality operator (==) not a greater-than operator (>).

As far as the isGreater property, you will want to compare someOperation to anotherOperation.

For instance, if I have the following code

let isLesser = 3<5

then isLesser will contain the boolean value of true because 3 is less than 5.

so if I want to know if an operation is greater than or equal to another operation, I will use the correct operator to find out (>=)

let isGreater = someOperation >= anotherOperation

now isGreater contains either true if someOperation is greater than or equal to another operation or false if it is not greater or equal to.

Reference the solution here if you are still having a hard time

// 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
// Task 2 - Enter your code below
let isPerfectMultiple = result==0

let isGreater = someOperation >= anotherOperation