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

deepak sharma
deepak sharma
3,844 Points

Second challenge is difficult to understand...how to proceeed next ...please help

// Enter your code below

var initialScore = 8

initialScore += 1

let isWinner = 10

operators.swift
// Enter your code below

var initialScore = 8


initialScore += 1


let isWinner  = 10

1 Answer

Erik Perez
Erik Perez
5,410 Points

Hello Deepak, The second task wants you to check if the initialScore constant is not equal to 10, and wants you to assign the answer to that comparison to a constant named isWinner.

Since we want to check if intialScore is not equal to 10, we will use the != (not equal to operator). We use that operator like this: 5 != 10 That will equal true because 5 isn't equal to 10

I provided the solution down below!

// Enter your code below

var initialScore = 8
initialScore += 1

let isWinner = initialScore != 10

Here, it checks if the initialValue is not 10

It will return true because initialValue is 9