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

What am I doing wrong?

Hey guys, I'm currently working with operators and I dont know why my code is not correct. Can anyone help me out? Thanks!

operators2.swift
// Enter your code below

var initialScore = 8
initialScore = initialScore + 1
let totalScore = ++initialScore
let isWinner = totalScore != 10
Aurelian Spodarec
Aurelian Spodarec
10,801 Points

What is the bummer saying to you?

Jared de Guzman
Jared de Guzman
4,811 Points
initialScore = initialScore + 1

Remove this line. You only need to increment initialScore once according to the problem.

Jari Koopman
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Jari Koopman
Python Web Development Techdegree Graduate 29,349 Points

Jared de Guzman Hey, just a quick tip, next time if you submit an answer, put it in the answers box and not in the comments box. That way the person who asked the question will get a notification he has an answer instead of a notification he has a comment!

2 Answers

Jari Koopman
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Jari Koopman
Python Web Development Techdegree Graduate 29,349 Points

Hey Justus,

The only thing wrong with your code is this line:

initialScore = initialScore + 1

This is the initial score so you shouldn't modify it. If you delete that line your code should work.

Hope this helped!

Regards, Jari

let isWinner = initialScore <= 10 ? true : false