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

Mir rawshan Ali
seal-mask
.a{fill-rule:evenodd;}techdegree
Mir rawshan Ali
Full Stack JavaScript Techdegree Student 1,113 Points

can not understad the question "Step 2: When value obtained using a remainder operator is 0, this means that the value "

i dont know how to solve 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

let result = 200 % 5
result = 0

let isPerfectMultiple != result



// Task 2 - Enter your code below

1 Answer

Hi Mir,

The remainder operator essentially divides a number by another number and provides the remainder as the value.

If the remainder value is 0, then the value is perfectly divisible by the divisor with no remainders left over.

You just have to compare the result constant to 0 using the equality operation == and assign this to a isPerfectMultiple constant.

let isPerfectMultiple = result == 0

This will ultimately render isPerfectMultiple as true or false (known as a boolean value). If result is equal to 0 then isPerfectMultiple is true.

I hope this helps.

All the best,

Mitch