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

mark hengstebeck
mark hengstebeck
1,119 Points

Task 1 of 2: // Task 2 - Enter your code below let isGreater = someOperation =< anotherOperation

I do not understand the question for task 2 of 2. Can anyone explain this?

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 = 0 == 0


// Task 2 - Enter your code below
let isGreater = someOperation =< anotherOperation
Christopher Nowack
Christopher Nowack
2,468 Points

let isGreater = (someOperation >= anotherOperation)

3 Answers

andren
andren
28,558 Points

Your code for step 2 is pretty much correct with the exception that you have an error in your greater than or equal to sign. The greater than or equal sign is ">=" not "=<". If you fix that mistake then you'll be able to pass task two.

Though I would also like to note that your solution for step 1 is not entirely correct, the challenge wants you to use the variables that already exist in the project to reference the various values, not to hard code them in the program by typing the numbers in directly like you have done. So the solution should look like this:

let result = value % divisor
let isPerfectMultiple = result == 0

In a real world program there is a big difference between referencing a variable (whose value might change over the runtime of the program) and hard coding in a number that will never change no matter what happens in the program, even though both solutions technically work for this simple exercise.

mark hengstebeck
mark hengstebeck
1,119 Points

Hi Andren, That's it! Thanks, Mark

mark hengstebeck
mark hengstebeck
1,119 Points

Hi Christopher, That's it! I see it works with parentheses or without parentheses on task 2 of 2. Thanks, Mark