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

Beau Enslow
Beau Enslow
408 Points

I am having some trouble answering this question. Can I get some help?

I am not sure how to apply this Not operator in order to assign it to the constant isWinner.

operators2.swift
// Enter your code below

var initialScore = 8

let totalScore = ++initialScore

10 != 10

3 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hiya Beau Enslow! You were doing great right up until the last line. You declared a constant in the line just above it. Now it wants a new constant. Then we're going to check to see if totalScore is equal to 10. If the score is not equal to 10 then true will be stored in the isWinner, and the person wins! Take a look at the line you need:

let isWinner = totalScore != 10

We declare our constant. We evaluate totalScore. If totalScore is not equal to 10 then true is stored in isWinner. Hope this helps! :sparkles:

Beau Enslow
Beau Enslow
408 Points

Oh that looks so easy! im not sure why I could not get it. That was extremely helpful. Thank you so much for your help!

Jared Watkins
Jared Watkins
10,756 Points

Jennifer is so right.

Also, != (or ==) evaluate to true or false. In the correct answer above, the '=' is used, and so is '!='. I think it looks a little strange to have them both appear in the same line together. But it works, and it's good. '!=' and '==' are not the same as '='. '==' and '!=' give you either true or false, where '=' assigns value to a variable or constant.