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 trialSpencer Terry
305 PointsI don't understand how to get past this challenge in string literal interpolation
I don't think I understand what the challenge is wanting me to do in regards to making the string literal interpolated
// Enter your code below
let firstValue = 2
let secondValue = 4
let product = firstValue * secondValue
let output: String = "(\The prduct of 2 times 4 is 8)"
2 Answers
Keli'i Martin
8,227 PointsThe \( )
syntax is used to translate the value of a variable into a string. In other words, if you have
var value = 10
Then the following line will use that to create the string "He is 10 years old."
var sentence = "He is \(value) years old."
Hope that helps.
Spencer Terry
305 PointsThank you!