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

Natasha Payne
Natasha Payne
121 Points

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

Natasha Payne
Natasha Payne
121 Points

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

2 Answers

Magnus Hållberg
Magnus Hållberg
17,232 Points

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?"
Natasha Payne
Natasha Payne
121 Points

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!

Elena Iliasova
seal-mask
.a{fill-rule:evenodd;}techdegree
Elena Iliasova
iOS Development with Swift Techdegree Student 1,739 Points

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?

Natasha Payne
Natasha Payne
121 Points

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