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 trialNate Drexler
1,883 PointsI'm stuck on this code challenge. See code below:
I thought I formatted the interpolation correctly
// Enter your code below
let name = "Nate Drexler"
let greeting = "\(Hi there,) \(name.)"
2 Answers
Jason Anders
Treehouse Moderator 145,860 PointsHey Nate,
There are a couple issues going on here.
You can not interpolate a string. Only variables / constants can be interpolated, so "Hi There," should not be enclosed in parenthesis.
The period needed cannot be added inside of a interpolated variable. You can add this two ways: After the closing parenthesis for the name variable but before the closing quote. Or just add in to the end of the value assigned to the name variable (I chose the latter).
Other than that... looks good. Below is the corrected code for you to reference. I hope it makes sense.
let name = "Nate Drexler."
let greeting = "Hi there, \(name)"
Cindy Lea
Courses Plus Student 6,497 Pointslet name = "Linda" let hello = "Hi there" let greeting = "(hello), (name)."
Nate Drexler
1,883 PointsNate Drexler
1,883 PointsThank you much, Jason. Makes perfect sense.