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 trialBenjamin Taylor
Courses Plus Student 2,379 PointsIssues with Interpolated String 1 of 2
I am stuck on the Interpolated "Hi there" problem
Keeps saying "Bummer! Make sure the value you are assigning to greeting is an interpolated string"
The code I am typing works in xcode, but not on the main site. I have tried several different ways. Not sure what I am doing wrong.
let name = "Ben" let greeting = "Hi there,"
let interpolated = "(greeting) (name)"
Also tried
let name = "Ben" let greeting = "Hi there"
let interpolated = "(greeting), (name)"
THERE ARE FORWARD SLASHES IN FRONT OF (greeting) and (name) IN BOTH EXAMPLES
Both work in xcode
2 Answers
Christian Mangeng
15,970 PointsHi Benjamin,
string interpolation requires the backslash "\". The greeting constant should store "Hi there, Ben".
let name = "Ben"
let greeting = "Hi there, \(name)"
Benjamin Taylor
Courses Plus Student 2,379 PointsTyping that gets me
"Bummer! Make sure you are declaring a constant called finalGreeting"
Still does not work. And as I said in my question above. I already have those slashes. For some reason they didn't show when I typed in this forum.
Also how are you able to add this screen capture
Christian Mangeng
15,970 PointsThe solution I wrote above was for task 1 of 2 (as stated in the title of your thread). If it asks for finalGreeting, this is another question. I wrote about the backslashes because you were talking about using forward slashes, therefore I wasn't sure whether you were using the correct type of slashes. In the "Markdown Cheatsheet" you can find the instructions on how to post your code in "screen capture" style. A link to it is below the "Add an Answer" field.