Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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