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

Luke Benson
Luke Benson
470 Points

I am not sure why the following is incorrect. " someOperation > anotherOperation = true let isGreater = true "

It says the answer should not just be a Bool value but a comparison but that is what I thought I was doing.

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 = 200 % 5
let isPerfectMultiple = true
// Task 2 - Enter your code below
someOperation > anotherOperation = true
let isGreater = true

2 Answers

Jeff McDivitt
Jeff McDivitt
23,970 Points

It seems you are a little confused, I would suggest going back and watching the previous videos because all of the processes are explained. Please review the correct answer and let me know if you have any questions

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
Thomas Dobson
Thomas Dobson
7,511 Points

Hi luke,

Your somewhat close. First let me explain what is wrong in your code:

// 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 = 200 % 5
let isPerfectMultiple = true
// Task 2 - Enter your code below
someOperation > anotherOperation = true //your comparing someOperation to anotherOperation then saying thats equal to true. This wont compile.

let isGreater = true //Your saying let constant named isGreater is equal to true.

Now take a look how it should be:

// 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 = 200 % 5
let isPerfectMultiple = true

// Task 2 - Enter your code below
let isGreater = someOperation >= anotherOperation //says let constant isGreater equal the boolean value of the comparison (someOperation >= anotherOperation)
Luke Benson
Luke Benson
470 Points

Thanks for the help!