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

Arius Eich
Arius Eich
2,769 Points

Not operator-What is incorrect?

It tells me it cannot covert an integer value to a bool value. How do I make it do that?

operators.swift
// Enter your code below

var initialScore = 8

initialScore += 1

let isWinner = initialScore = !10

2 Answers

Matt Skelton
Matt Skelton
4,548 Points

Hey Arius,

You're very close, the reason why you're getting the current error is because you're using the not operator directly on your integer value.

Instead, you want to move the not operator to the point where you compare the value of initialScore against the number 10.

let isWinner = initialScore != 10

Like so. This should do the trick, hope that helps!