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

Ahmed Asif
Ahmed Asif
479 Points

I'm stuck on the 2nd task of the assignment challenge, someOperation >= anotherOperation let isGreater = false

Here's what I have in Xcode and it seems to run fine

let value = 200 let divisor = 5

let result: Int = value % divisor result == 0

let isPerfectMultiple = true

let someOperation = 20 + 400 % 10 / 2 - 15 let anotherOperation = 52 * 27 % 200 / 2 + 5

someOperation >= anotherOperation

let isGreater = false

BUT its not being accepted

operators.swift
// Enter your code below
let value = 200
let divisor = 5

let result: Int = value % divisor
result == 0

let isPerfectMultiple = true


let someOperation = 20 + 400 % 10 / 2 - 15
let anotherOperation = 52 * 27 % 200 / 2 + 5

someOperation >= anotherOperation 

let isGreater = false

// Task 1 - Enter your code below

// Task 2 - Enter your code below

Complete shot in the dark, but have you tried putting your answers in the marked places? (//Task 1 - enter your code below, and //task 2 - enter your code below)?

I feel like the challenge would let me pass the first task, but would not let me pass the second until the answers were in their "proper place"?

2 Answers

Ahmed Asif
Ahmed Asif
479 Points

Hey thanks man, I tried but for some it didn't accept it that way either, I guess than there must be something wrong with the code

Okay, I pulled up the challenge and reviewed what I solved with versus what you have. I dont want to straight out tell you what the answer is, but I would say look back over your code:

let result: Int = value % divisor result == 0

and

let isGreater = false

as spots where the challenge disagrees with your answer.

I think it's because you haven't assigned an argument/comparison to isPerfectMultiple.
Assign, result in the argument instead.

let isPerfectMultiple = result == 0

Ahmed Asif
Ahmed Asif
479 Points

I completely messed up on that part, I got it now, I didnt assign an argument to isGreater or isPerfectMultiple Thanks Robert and wwyattw