Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS Swift Basics Swift Operators Working With Operators: Part 2

Yun Yin Ku
Yun Yin Ku
1,493 Points

Unable to make the isWinner declaration

I’m currently stuck in !10 score for winner statement

operators.swift
// Enter your code below

var initialScore = 8
initialScore += 1

let isWinner = 9
10 != true

1 Answer

John Lack-Wilson
John Lack-Wilson
8,168 Points

Hey Yun, thanks for the question.

The challenge is asking you to do the following: Declare a constant named isWinner and assign the results of a comparison operation to check whether the player has won or not.

So, in other words it wants you to assign isWinner using a comparison operation (i.e. an operator that compares values). Here's a similar example to help, where I am declaring a constant to see if something is not 30.

var score = 15

let notThirty = score != 30

We can use '!=' to compare if something is not equal to something else.