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 2.0 Basics Swift Types String Manipulation

MINJI KIM
MINJI KIM
1,905 Points

let name = "Minji." let greeting = "\(Hi there, )" + name + "\(.)"

i'm doing this .. whats wrong?

strings.swift
let name = "Minji."
let greeting = "\(Hi there, )" + name + "\(.)"

1 Answer

Tobias Helmrich
Tobias Helmrich
31,603 Points

Hey there Minji,

the problem in your code is that you have to interpolate the constant inside of a String and assign it to the greeting constant but right now you're trying to interpolate the String itself and you're using concatenation to add the name constant (you'll have to use concatenation in the next part of the challenge by the way).

To interpolate the constant name you can just write the String like you would normally do but you have to write the constant you want to interpolate inside of \() .

Like so:

let name = "Minji"
let greeting = "Hi there, \(name)."

I hope that helps, if you have further questions feel free to ask! :)