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 trialMohammed Abdulwahab
1,477 PointsHow could this be wrong !
var initialScore = 8
initialScore = initialScore + 1
let totalScore = initialScore
// Enter your code below
var initialScore = 8
initialScore = initialScore + 1
let totalScore = initialScore
3 Answers
Cindy Lea
Courses Plus Student 6,497 PointsThe want you to do the totalscore & increment in 1 statement:
var initialScore = 8
let totalScore = ++initialScore
Jennifer Nordell
Treehouse TeacherCindy Lea is correct. Your code is functional but you missed this line in the instructions "let's add 1 point to their score using the increment operator". You must use the increment operator for this challenge. It's important to note though that as of Xcode 7.3 the increment operator will be deprecated, so don't get too used to using it in Swift.
Code challenge specifications should be followed to the letter. Any deviation can cause the challenge to fail even if your code is functional outside the challenge. Happy coding!
Mohammed Abdulwahab
1,477 PointsThank you