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 trialEdwin Brown
Courses Plus Student 1,787 PointsNeed help with code
I may not understand the output of the question
// Enter your code below
var initialScore = 8
let totalScore = ++initialScore
//let isWinner = totalScore
var player = totalScore
let isWinner = true
let isLoser = !isWinner
2 Answers
Jari Koopman
Python Web Development Techdegree Graduate 29,349 PointsHi Edwin,
You don't need the isLoser part of the code. This works just fine:
var initialScore = 8
let totalScore = ++initialScore
let isWinner = totalScore != 10
Hope this helped,
Kind regards, Jari
Simon Coates
28,694 PointsI'm not familiar with swift, and i'm not sure what the issue is, but the following code passed:
var initialScore = 8
let totalScore = ++initialScore
//let isWinner = totalScore
var player = totalScore
let isWinner = totalScore != 10
let isLoser = !isWinner
Uncertain if that helps you.
Edwin Brown
Courses Plus Student 1,787 PointsEdwin Brown
Courses Plus Student 1,787 PointsThank You