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 trialJosef Dosch
2,619 PointsIt says not assigning "greeting" to an interpolated string let greeting = "\("Hi there") \(name)\(".")" works in Xcode
What am i missing
// Enter your code below
let name = "Joe"
let greeting = "\("Hi there,") \(name)\(".")"
1 Answer
Jason Anders
Treehouse Moderator 145,860 PointsHey Josef,
I'm actually very surprised that this would actually work in Xcode.
First you can't interpolate a string... only variables can be interpolated. And it seems like you may be trying to mix interpolation with concatenation. For Interpolation, you only use 1 opening quotation mark and 1 closing quotation mark. The strings are just a normal string inside, and then you add the interpolated variables as needed.
Below is the correct code for your reference. I hope it'll make sense. If you're not 100%, I recommend that you review String Interpolation before moving on, as it is a very integral part of the upcoming lessons.
let name = "Joe"
let greeting = "Hi there, \(name)."
Keep Coding! :)
Josef Dosch
2,619 PointsThank you, i understand now.
Reed Carson
8,306 PointsReed Carson
8,306 Pointsjust a comment. I think this is the #1 question I see about iOS here, this very example, and everyone basically does this same thing more or less.