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
4,332 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