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 trialstr
3,149 PointsI don't understand how to assign the string literal to the constant "output" An explanation would be greatly appreciated
I'm completely stuck on this code challenge, I don't believe I fully understand what if going on here. If someone could offer an explanation I'd greatly appreciate it. Thank you for your time.
// Enter your code below
let firstValue = 10
let secondValue = 20
let product = a * b
let interpolatedValue = \(The product of 2 times 4 is 8)
let interpolatedoutput =
1 Answer
jcorum
71,830 Pointslet firstValue = 10
let secondValue = 20
//you used a * b, but you have no variables named a and b. Instead, use the two variables
//you do have, firstValue and SecondValue
let product = firstValue * secondValue
//Then use String interpolation to display those values in a String:
let output = "The product of \(firstValue) times \(secondValue) is \(product)."
str
3,149 Pointsstr
3,149 PointsThank you for explaining this out. I see how it makes sense now.