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 2.0 Basics Swift Operators Working With Operators: Part 2

Swift

Please help me answer this, I can't solve.

1 Answer

Hi Maged,

The first part wants you to assign an incremeneted value of initialScore to totalScore so they both have the same value. To do this, use the increment operator, ++. If you put that in front of the variable you want to increment (add one to), it'll do the increment first, then do the assignment. So:

let totalScore = ++initialScore

This adds one to initialScore then assigns that new value into totalScore.

Next, you want to see if totalScore is not equal to 10; evauate that to true or false and assign that value into a constant called isWinner. So, you want to see if totalScore is not equals - that's this operator: !=. Compare totalScore to 10 using that, and assign the result into isWinner:

let isWinner = totalScore != 10

I hope that helps.

Steve.