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 trialNader Habib
1,106 PointsIn this game of ours, we have an odd scoring mechanism . At the end of the round, if your score is 10, you lose! If it's
what was wrong ??
// Enter your code below
var initialScore = 8
let totalScore = ++initialScore
let isWinner = totalScore != 10
1 Answer
Nader Habib
1,106 PointsThanks for the answer but I still dont understand y my answer was wrong can u please explain ??
Jason Anders
Treehouse Moderator 145,860 PointsThe unary operator ++
was deprecated in Swift 2 and has been removed in Swift 3. To increment, bora is correct, you can only use the +=
operator.
bora
1,730 Pointsbora
1,730 PointsYou have to increase the value of initialScore using the += operator. You don't need a variable for the total score