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 trial

iOS Swift Basics Swift Types String Manipulation

Xcode says my code is correct, but Teamtree says it is not?

Please help, with my code below. Teamtree won't let me move to the next part, however Xcode reads my code correctly??

// Enter your code below 
let name = "Natasha" 
let greeting = "Hi there, (name)" 
let finalGreeting = "(greeting). How are you?"

You haven't posted your code yet

'''// Enter your code below let name = "Natasha" let greeting = "Hi there, (name)" let finalGreeting = "(greeting). How are you?" '''

2 Answers

You have forgotten the "\" backslash in the string interpolation.

let name = "Natasha" 
let greeting = "Hi there, \(name)"

For the second task you are supposed to use concatenation, not string interpolation.

let finalGreeting = greeting + " How are you?"

I did use 'backslash' but for some reason it didn't show up when I copied and pasted it here. However, I don't know how to use concatenation, so I will deffo use the example you have given above. Thank you for your help!

hello. help me please. my code is correct I check in MyPlayground, but Teamtree says it is not.let name = "Alena" let greeting = "Hi there, (name)" let finalgreeting = greeting + ". How are you?" I see my code on a right console "Hi, there, Alena. How are you?

// Enter your code below let name = "Natasha" let greeting = "Hi there, (name)" let finalGreeting = "(greeting). How are you?"