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 trialLucas Peters
Courses Plus Student 1,003 PointsWhat is wrong?
let name = "Lucas" let greeting = "(Hi there), (name)"
what is wrong in here?
2 Answers
Jason Anders
Treehouse Moderator 145,860 PointsHey Lucas. Welcome to Treehouse.
You are on the right track, but you have a couple issues with the 2nd line of code. First off, you can't interpolate a string. You can only interpolate variables. Here you are putting what should be the string "Hi there, " inside of parenthesis, which cannot be done.
Second, you are missing the backslash \ which lets the compiler know that you want to interpolate included variable into the string.
Below is the correct code for your reference. Make sure it all makes sense before moving on. If you're still unsure, I would recommend reviewing the video on String manipulation, as this as well as concatenation play a bigger role as you move forward.
let name = "Lucas"
let greeting = "Hi there, \(name)"
Keep Coding! :)
Nils Garland
18,416 PointsYou are using the interpolation to type Strings. This is not correct. You simply type "Hi there, " as a string and add the variable next to it. Here is my solution. I suggest you re watch a couple videos
let name = "Lucas"
let greeting = "Hi there, \(name)."
Hope it helps
Jason Anders
Treehouse Moderator 145,860 PointsNils Garland Curious as to why you would downvote a correct answer (Especially a Treehouse Moderator's answer)?
Just to get yours on top?
Nils Garland
18,416 PointsNils Garland
18,416 PointsJason Anders So sorry, ment to upp vote xD Btw how long have you been on this site? You have like a ridiculous amount of point.