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!

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

String confusion

I'm being told i'm not assigning the correct string to the variable? is the string not (name)" ?

// Enter your code below
let name = "Shaun"
let greeting = "\("Hi there, ") \(name)"

1 Answer

28,552 Points

You don't need to wrap all of the text of an interpolated string in \() blocks. You only need to wrap variables names you want to insert. So the string should look like this:

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