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

im not getting this I think its saying that ++ isn't allowed in swift 3 anymore

does this challenge need to be updated?

operators.swift
// Enter your code below

var initialScore = 8
initialScore += 1

let totalScore = +=initialScore

let isWinner = totalScore !=  10

1 Answer

István Halász
István Halász
2,896 Points

Hi John!

No this challenge doesn't need to be updated. I also had that problem when I were there and I thought the same thing as you, but I found out that I am overcomplicating it. The problem in your code is that you actually don't need the totalScore, because the initialScore will be 9 after the second line and if you use that initialScore instead of the totalScore, your code will work. And just to know, you cannot use the += operator like you used in the third line of code, because it isn't correct syntactically.

Your code should look like this:

var initialScore = 8
initialScore += 1
let isWinner = initialScore != 10

thank you so much I was stuck on that problem for a while