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 2.0 Basics Swift Operators Working With Operators

This is a confusingly, verbose question. What am I to do with the constants someOperation and anotherOperation?

The question is worded horribly. I used what was told and I am getting a wrong answer. I suggest you make it more clear.

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 = value % divisor

if(result == 0){
  let isPerfectMultiple = true
}

// Task 1 - Enter your code below

// Task 2 - Enter your code below

1 Answer

Zachary Kaufman
Zachary Kaufman
1,463 Points

You don't need an if statement, all you need to do is

let isPerfectMultiple = result == 0

because that means isPerfectMultiple will be True if result is == 0 and False if result == 0 automatically without using an if/else statement.

Yeah I figure it out, I just thought they were using "value" in two different contexts.