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

what am i doing wrong?

I believe I am following all of the directions but i keep getting a "bummer!". What am i doing wrong?

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

let isPerfectMultiple = true


// Task 2 - Enter your code below


anotherOperation >= someOperation

let isGreater = true

1 Answer

Hey Frank, You are close. I've put some comments in the code to point out what you need to fix.

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
// A value is set to the constants "value" and "divisor", so just use the names.
let result = value % divisor

//They want you to compare the result to zero
// so you need to use the comparison operator equal to
// Then assign it to a constant name isPerfectMultiple 
let isPerfectMultiple = result == 0

// Task 2 - Enter your code below
// In task 2, they want to know if someOperation is greater than or equal to anotherOperation
// and assign it to a constant name "isGreater" 
let isGreater = someOperation >= anotherOperation

Hope this help