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

Nader Habib
Nader Habib
1,106 Points

In 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 ??

operators.swift
// Enter your code below

var initialScore = 8
let totalScore =  ++initialScore 

let isWinner = totalScore != 10 
bora
bora
1,730 Points
var initialScore = 8


initialScore += 1

let isWinner = initialScore != 10 

You have to increase the value of initialScore using the += operator. You don't need a variable for the total score

1 Answer

Nader Habib
Nader Habib
1,106 Points

Thanks for the answer but I still dont understand y my answer was wrong can u please explain ??

Jason Anders
Jason Anders
Treehouse Moderator 145,860 Points

The 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.

:dizzy: