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 2.0 Basics Swift Operators Working With Operators: Part 2

Yen Ho
seal-mask
.a{fill-rule:evenodd;}techdegree
Yen Ho
Full Stack JavaScript Techdegree Student 4,708 Points

HOW CAN I SOLVE THIS PROBLEM? IM DO NOT QUITE UNDERSTAND THE QUESTION

WHAT ARE STEPS TO SOLVE THIS ONE?

THANKS

operators2.swift
// Enter your code below

var initialScore = 8
Ben Masel
Ben Masel
2,004 Points

if you need my help again just ask me : )

1 Answer

Ben Masel
Ben Masel
2,004 Points

Hi there! Firstly there is a variable called initialScore that holds the value of 8, in the instructions it says to add a constant named totalScore which is supposed to equal initialScore + 1. Now the new operators that i am sure you have learned are ++ and --. so you have to create a constant called totalScore and make it equal initialScore + 1. The catch is they both have to equal the same amount so you need to use the ++ operator to increment initialScore by 1 and then put the initialScore's value back into the totalScore.Hope this helps : )