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

string

let name ="Tenzin" let greeting = "Hi there" let name ="Linda" let concenteName = name + "," + greeting + "," + name // string Interpolation let interpolatedName = "(name) , (greeting) , (name)"

it is not working. please help me for this solution

2 Answers

Hi, you concatenated correctly. (combining stuff = concatenation)

The interpolation is not correct however. (inserting stuff = interpolation)

To interpolate you need to break out of the String("") using the backslash \

let interpolatedName = "\(name) , \(greeting) , \(name)"

There is a couple of things. First, your using the same constant name for two constants and that won't work. You have

let name = "Tenzin"
let name = "Linda"

// Should be
let someName = "Tenzin"
let anotherName = "Linda"

You need to have unique names for every constant or variable. The other thing is your string interpolation isn't formatted correctly. If your going to present your constants in the string, you need to have it formatted like this:

let interpolationName = "\(name), \(greeting), \(otherName)"

Hope that helps. Just check your names and your formatting.