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: Part 2

Ron Tovbin
seal-mask
.a{fill-rule:evenodd;}techdegree
Ron Tovbin
Python Web Development Techdegree Student 6,268 Points

I've checked my code and it looks correct. This is frustrating.

var initialScore = 8 initialScore += 2

if initialScore != 10 { let isWinner = true } else { let isWinner = false }

operators.swift
// Enter your code below

var initialScore = 8
initialScore += 1

if initialScore  != 10 {
    let isWinner  = true
} else {
      let isWinner  = false
}

3 Answers

Try this: let isWinner = initialScore != 10

Thomas Dobson
Thomas Dobson
7,511 Points

Hi Ivan,

Your code is logically sound, works within xcode; but is a bit over complicated. As such its not quite what the challenge was looking for. You can simplify the solution a bit like so:

 var initialScore = 8

 initialScore += 1

let isWinner: Bool = (initialScore != 10)

You will find that some challenges are looking for specific ways to solve the problem, while other challenges will be more forgiving. I hope this helps!