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 trialBrice Corbin
1,872 PointsDon't understand why it doesn't work
I'm trying to use the same thing as we say on the lesson and it keeps saying me that i need to make sure the value of greeting is an interpolation
// Enter your code below
let name = "Brice"
let greeting = "\("Hi there,") \(name) + \(".")"
3 Answers
Chris Stromberg
Courses Plus Student 13,389 PointsThis part is correct.
let name = "Brice"
The next part needs a little work. interpolation simply takes the object (name object) and places it within your string. To do that you need to use
\()
to contain whatever object it is you want place in your string.
For example
let greeting = "Hi there, \(name)."
Brice Corbin
1,872 PointsThanks guys, was confused that was I actually did first, but the exercice returned an error. Wasn't really explicit that i had to create 2 constants and they interpolate them... So this: let greeting = "Hi there, (name)."
Was returning my exercice as wrong which confused me. All good now :)
Jordi Gámez
3,568 PointsHere you are:
// Enter your code below
let name = "Brice"
let greeting = "Hi there, \(name)."