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 trialDaniel Springer
Courses Plus Student 5,090 PointsWhat am I doing wrong?
let name = ("Daniel.") let greeting = "Hi there, (name)" let finalGreeting = "(greeting) How are you?"
// Enter your code below
let name = ("Daniel.")
let greeting = "Hi there, \(name)"
let finalGreeting = "\(greeting) How are you?"
2 Answers
Jason Anders
Treehouse Moderator 145,860 PointsHey Daniel,
While your code is technically correct, it is not what the challenge asks for.
The final task is to use string concatenation not interpolation.
So
let finalGreeting = "\(greeting) How are you?"
Should be
let finalGreeting = (greeting) + "How are you?"
Also, just a suggestion. Instead of putting the period after you name stored in the variable, you should put it after the \(name)
in the interpolated string. For this example either work and cause no problems, but in a large project, if you were to reuse your name variable in the middle of a sentence, the period would still show up and be out of place. Make sense?
Hope this helps. Keep Coding! :)
Daniel Springer
Courses Plus Student 5,090 PointsHi Jason,
I did not pay attention there, I see now what I did wrong. Thanks for the quick reply and for the advice, I will keep it in mind.