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

Working with Operators

I'm not understanding this question. I looked at previous questions, and I still do not see what I am doing wrong. Can someone help guide me as to what I am doing wrong?

operators.swift
var initialScore = 7
let totalScore = initialScore + 1
let isWinner = totalScore != 10

1 Answer

David Papandrew
David Papandrew
8,386 Points

Hi Lisa,

Your code is valid but the Treehouse code challenges have very specific requirements. For instance, the challenges will be very specific about any new variables or constants they want you to create.

In this case, they don't want you to create a new constant (what you have named totalScore). Instead, they want you to increment the initialScore with the unary plus operator (+=). It's confusing, I know, since they refer to the initialScore as "total score" in challenge description.

So if you write your code this way, it will pass:

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

Ah! That makes sense. Thank you!