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

Christopher J Doyle
Christopher J Doyle
682 Points

Not sure what they are talking about, Can someone please help and explain it better. Please

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

// Task 2 - Enter your code below let isPerfectMultiple =

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

// Task 2 - Enter your code below
let isPerfectMultiple = 

2 Answers

Clark Reilly
Clark Reilly
6,204 Points

IsPerfectMultiple should be a boolean value that tells you if the value is a multiple of the divisor E.G.

  • 10 / 5 = 2 R0: true
  • 12 / 5 = 2 R2: false So if R (which is result) is 0 then isPerfectMultiple = true

Also, task 1 should use the constant names, not the literal numbers

I strongly suggest you try to solve the problem on your own or rewatch the video rather than copy pasting my answers. You should only use them if you are really stuck

If that wasn't clear enough, this is the full answer:

let result = value % divisor
let isPerfectMultiple = result == 0
Christopher J Doyle
Christopher J Doyle
682 Points

Thank you for your help I really appreciate it and yes, I agree I should rewatch and do it on my own