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

For this challenge, let's pretend we're building a calculator that outputs a string with the result of a math operation.

For this challenge, let's pretend we're building a calculator that outputs a string with the result of a math operation.

Start by declaring two constants, firstValue and secondValue and to both of them assign some integer values (whatever you want! don't go too crazy though) Im Trying this code.

let firstVale: Int = 3 let secondValue: Int = 4 3+4 var Int = 3.0 firstVale + secondValue

types.swift
let firstVale: Int = 3
let secondValue: Int = 2
firstVale + secondValue

1 Answer

Tobias Helmrich
Tobias Helmrich
31,601 Points

Hey there Karthik,

the problem why you're not passing the task is that the first constant has to be called firstValue instead of firstVale. Also note that you don't have to use type annotation here and that you don't have to add both values together for the first task but if you want to that's fine as well! :)

The solution for the first task could look like this:

let firstValue = 3
let secondValue = 2

I hope that helps! :)