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 trialHunter Hayes
1,415 PointsWhen I set my greeting as an interpolated string it gives me errors about the "Hi there,". How should I fix this?
What should I do to the interpolated string to fix this?
// Enter your code below
let name = "Hunter"
let greeting = "\(Hi there), \(name)."
1 Answer
Dan Hillman
4,394 Points"Hi there," does not need to be interpolated because it is not a variable or constant, it is just a string. When you interpolate a variable or constant with the back slash parentheses syntax, you are referencing the value within the variable or constant.
So, your code should look like this:
//Enter your code below
let name = "Hunter"
let greeting = "Hi there, \(name)."
Hunter Hayes
1,415 PointsHunter Hayes
1,415 PointsThank you for your help. I appreciate it! I was a little confused on interpolated strings at first but I am starting to get the hang of it now.