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 trialKevin Ng
862 PointsHow do you do Challenge Task 2 of 2?
I am stuck on this question. Please assist! Thank you!
1 Answer
Steve Hunter
57,712 PointsHi 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.
Kevin Ng
862 PointsKevin Ng
862 PointsThanks for the detailed explanation, Steve!
Much appreciated, and I'm able to move on to the next part now.
Kevin