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 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