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!

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

Dominiq Martinez
Dominiq Martinez
1,949 Points

what does it mean to compare using the equality operand and setting it equal to a constant. How can you compare in a con

These instructions lead me to code out "let isPerfectMultiple = (result == 0)

// 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

// Task 2 - Enter your code below

let result = value % divisor

let isPerfectMultiple  result== 0

1 Answer

Wouter Willebrands
.a{fill-rule:evenodd;}techdegree seal-36
Wouter Willebrands
iOS Development with Swift Techdegree Graduate 13,121 Points

Hi Dominiq,

The equality operator == is used to check wether the value on the left side is equal to the value on the right side. If it is it returns true otherwise it returns false. In this case:

let isPerfectMultiple = true

However for this specific case:

let isPerfectMultiple = result == 1

Would return false.

You can read more about operands here

I hope this answers your question. Happy coding!