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

let value: Double = 200 and let divisor: Double = 5 let result = value%divisor, this is not working,error?

let value: Double = 200 and let divisor: Double = 5 let result = value%divisor, this is not working,error?

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

let result = value%divisor

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

// Task 1 - Enter your code below
someOperation == 0.0
let isPerfectMultiple: Double = someOperation


// Task 2 - Enter your code below
let anotherOperation !=0

2 Answers

In this challenge you won't be modifying any of the values already given so you may want to start over. You have the following correct:

let result = value%divisor

The next step is to compare result to 0 and assign the result to isPerfectMultiple.

Thanks