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

I feel I have accurately answered this equation but I am not getting the answer

please help me get the right answer because I am unsure of what I am doing wrong

operators2.swift
// Enter your code below

var initialScore = 8
initialScore = ++8
var totalScore = initialScore

3 Answers

You need to use the increment whilst creating the const/variable.

let totalScore = ++initialScore

turns out the answer was

let totalScore = +initialScore

Thanks for your response though

The answer answered your question so give it a thumbs up so others know it's answered (and to show appreciation for someone helping you).

Hi Richard,

Here is the answer for tasks 1 and 2. Create a constant totalScore and assign it to the incremented score. The constant, isWinner is checking if the score is not 10. If the score is anything else but 10, you win.

// Enter your code below

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

Hope this helps, Dave