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 Types Recap: Swift Types

Need quick help

why isn't this working

let firtValue:var = 1
let secondValue:var = 2

Hi Raz, first you declared a constant with let, added the name firstValue or secondValue, you need to add the type. Adding the type first add (:) space and Type. in this case your type is Int. Solution: let firstValue: Int = 1 let secondValue: Int = 2

1 Answer

There are three errors here. First, the first value constant is spelled firstValue. Next you have declared the constant firstValue's type as a variable, which is not even a type. It is not necessary to declare these constant values' types, but if you were then the numbers 1 and 2 are integers. The correct code would be :

let firstValue: Int = 1
let secondValue: Int = 2