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 trialCourtney Cassar
1,407 PointsI've declared let name = "Courtney" but on the next line am I meant to let greeting = "Hey, there" ?
and then do I make it interpolated?
// Enter your code below
let name = "Courtney"
let greeting = "\"Hey There,", (name)"
4 Answers
Alexander Davison
65,469 PointsFirst, you only need one string. Second, I don't see why the \
is way in the front of the string. Huh? You heard, you need the \
in front of the ()
, not in front of the string!
Third, your string in general isn't the string the challenge wanted. The challenge wanted something like "Hi there, Courtney" but your string returns "Hey There, Courtney". Code challenges are very picky and will cause a Bummer! message if you don't do exactly what it says.
Anyway, this is the correct string that you should assign to greeting
:
"Hi there, \(name)"
lvwdhydynw
6,443 PointsYou're almost there. First, you have way too many " there. You need just 2: "The left one starts the string and the right one ends it".
Now, if you want to add a variable/constant to an string, you do it like this: (nameOfVariable)
For example, if you have a constant named color with value "red" and you write such code "My favorite color is (color)", it will print out this: My favorite color is red
Tyler Dotson
Courses Plus Student 1,740 PointsAlecander Davison, how do you had code into your comment
Alexander Davison
65,469 PointsRead the markdown cheatsheet.
It is below the answer box.
Scroll to the bottom of the page and look beneath the answer box.
If you want to learn more about the markdown cheatsheet, look here
Tyler Dotson
Courses Plus Student 1,740 PointsI honestly dont know what the back sticks are.
this, \ or this, '
Alexander Davison
65,469 PointsThe backtick character is right below the esc
key.
Here: `
Note that the backtick character ` isn't the same as the single quote character '
Tyler Dotson
Courses Plus Student 1,740 Pointslet greeting = "Hi There, \(name)"
Alexander Davison
65,469 PointsYou got it