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

What's next? I don't understands the full question

Please help with the next of the code..

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 % divisor

let isPerfectMultiple = result

// Task 2 - Enter your code below

1 Answer

Dan Lindsay
Dan Lindsay
39,611 Points

Hello Or,

First off, for your result constant, they want you to use the other constant names in your operation, like so:

let result = value % divisor

I remember step 2 confusing me a lot when I first tried it. I know for me, I tried to make it more complex than it had to be. So, to compare result to 0 to see if they are the same is this:

result == 0

So let’s assign that to a constant named isPerfectMultiple, like so:

let isPerfectMultiple = result == 0

So this creates a Boolean constant, that when result is equal to 0, will show true. You could even declare it explicitly to make it a bit easier to understand.

let isPerfectMultiple: Bool = result == 0

and either should pass the challenge. Hope this helps!

Dan