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

How do you do Challenge Task 2 of 2?

I am stuck on this question. Please assist! Thank you!

1 Answer

Hi Kevin,

You should have two constants. One called fistValue and another called secondValue.

You then want to create a third constant called product that contains the first two multiplied together.

Lastly you want to make a string and assign it into a constant called output. In that string type out "The product of times is ". In the relevant places interpolate the three constants into it. To interpolate, use a backslash and parentheses - put the name of the constant inside the parentheses. Here's an example:

let age = 21
let output = "I am \(age) years old"

So you just need to build a different string an insert the three values at the relevant places.

I hope that helps.

Steve.

Thanks for the detailed explanation, Steve!

Much appreciated, and I'm able to move on to the next part now.

Kevin