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

Nischal shrestha
Nischal shrestha
189 Points

I didn`t understood challenge task

I did`t got what the question is asking for

operators.swift
// Enter your code below
let value = 200
let divisor = 5

let someOperation:bool = 20 + 400 % 10 / 2 - 15
let anotherOperation:bool = 52 * 27 % 200 / 2 + 5

// Task 1 - Enter your code below
let result = 200%5
// Task 2 - Enter your code below
let isPerfectMultiple = result == 0

let isGreater = someOperation  anotherOperation

2 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hey there,

You've pretty much got it, there are just a couple of minor things.

First, you altered some of the preloaded code, and the instructions did not tell you to do so, and that will cause an error. You added :bool to two of the predefined constants. That will need to be deleted and the preloaded code restored back to the original code.

Second, you seem to be using a symbol I've never seen before in coding... I'm not even sure how to recreate it. In your last line of code, the code is correct, but the symbol for greater than or equal to is >=

While what you have is technically a symbol for that, it will not be recognized by any code editor, so you will need to use the two characters > and = together.

Fix those up and everything else looks good! :)

Keep Coding! :dizzy:

Hey, Nischal!

You're getting the hang of it! In Task 1, you were supposed to create a constant called isDivisible and assign it to a value with the boolean value of whether the value and the divisor is divisible. Also, as Jason said, you may have played around with the code that was provided for you in the challenge.

For the 1st task, add this line:

let isDivisible = result == 0

I hope this helps! Good luck with the rest of the course!