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

JUAN BORRAS
JUAN BORRAS
716 Points

Bool

Having a lotta trouble since got to this part. I understand tutorial, but then I´m having a hard time going through the quiz. Don´t know if I´m missing information or that I don´t get the point of coding. Understand someOperation < anotherOperation , but how do I assign a Bool number 1 to a constant isGreater. Getting really frustrated. Thank you

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

someOperation < let anotherOperation
let isGreater = someOperation < let anotherOperation

3 Answers

Michael Hulet
Michael Hulet
47,913 Points

You just have a couple of syntax errors. You already declared anotherOperation before in your code, but you're using the let keyword to redeclare it again in the last 2 lines of your code. That isn't necessary. If you remove the 2nd to last line of your code (it isn't needed and doesn't form a valid expression) and remove the let keyword from the last line of your code, everything will compile just fine.

However, pay attention to the last part of the challenge. It asks you to compare the values using the greater than or equal operator (>=) instead of the less than operator (<), which you're using. If you fix those mistakes, your code passes the challenge. Great job!

JUAN BORRAS
JUAN BORRAS
716 Points

Hi Michael, But the last part of the challenge asks me to assign it to a Boolean number. If I write let isGreater = anotherOperation > someOpertation is true. But, where do I write the Bool?

Thanks