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 Branca
992 PointsPotential treehouse error
I think there is a mistake. The code worked and looked fine in XCode but when I copied it over it wasn't correct.
// Enter your code below
let name = "Daniel Branca"
let greeting = "Hi there,"
let interpolatedGreeting = "\(greeting) \(name)"
2 Answers
Bruce Röttgers
18,211 PointsHey,
you're only supposed to declare 2 constants.
You should use string interpolation in the greeting constant.
Hope that helps, but don't hesitate to ask if there is something unclear. Bruce.
Daniel Branca
992 Pointsahhh makes sense.
So the way I had works, but that just wasn't the task, correct?
Thanks dude!
Bruce Röttgers
18,211 PointsYes, you over complicated it a bit.
jenko
8,562 PointsDon't forget to mark answers to your question as correct.
That helps other people see that your question has been answered and other students find answers for questions that may have already been answered.
:)
Daniel Branca
992 PointsDaniel Branca
992 Pointsthanks for the response!
Hmm sorry I dont know what you mean. I thought I was to declare the name at the greeting and put them together in the a string?
Bruce Röttgers
18,211 PointsBruce Röttgers
18,211 PointsYes, but you're actually supposed to put them together in the greeting variable.
--> let greeting = "Hi there, (name)"