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

What is not good in here?

I don't get it, what is not good in here?

// Enter your code below

let firstValue: Int = 100
let secondValue: Int = 50

let answer: Int = firstValue + secondValue

let product = "\(firstValue * secondValue)"

let output = "The product of 100 times 50 is \(product)"

1 Answer

Hi Lucas,

Firstly, for this challenge I think your answer constant is redundant , as I don't recall the challenge to ask for it.

Secondly, looking over the string interpolation's definition might be of help. I've fetched it for you:

String interpolation is a way to construct a new String value from a mix of constants, variables, literals, and expressions by including their values inside a string literal.

Thirdly, in the output constant, you aren't asked to hard code the values , but to construct your constant making use of string interpolation and your constants.

Finally, if you've read all of the above and still feel a bit confused, I'll provide an example below. However, I do hope you've had another go at it yourself before simply copying.

let firstValue = 10
let secondValue = 6

let product = firstValue * secondValue

let output = ("The product of \(firstValue) times \(secondValue) is \(product)")