"Swift Basics" was retired on May 31, 2020.

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

I need your help with Swiftbasic, working with operators part 2

if player score 10 that means he lose.

Declare a constant named isWinner and assign the results of a comparison operation to check whether the player has won or not. For example, if the total score is not 10, then the player has won and isWinner should equal true. (Hint: Use the NOT operator)

here is the course work

var initiaScore = 8

// adding 1 to the initialScore, i did

initialScore += 1

/*which was correct, now to declare constant names isWinner and assign the results of a comparison opreation to check if the player won */

initialScore = initialScore !=10

let isWinner = initialScore.

// im getting error for this can someone help me please..

operators.swift
// Enter your code below

var initialScore = 8

initialScore += 1

let isWinner = initialScore !=10

2 Answers

Jeff McDivitt
Jeff McDivitt
23,970 Points

You have a space between = and 10

var initialScore = 8

initialScore += 1

let isWinner = initialScore != 10

Thanks so much, that works for me.. thanks..