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

Alyson Gant
Alyson Gant
1,585 Points

I am having trouble connecting the interpolated greeting to the constant.

Please read the question above

strings.swift
let name = "Aly"
let greeting = "Hi there"

letinterpolatedGreeting = "\(greeting), \(name)"

1 Answer

Alphonso Sensley II
Alphonso Sensley II
8,514 Points

Hello Alyson Gant You've almost got it! Just remember the challenge wants you to "Set the value of greeting to an interpolated string that combines "Hi there, " with the string stored in the name constant."

let name = "Alphonso"
let greeting = "Hi there, \(name)"
Greg Kaleka
Greg Kaleka
39,021 Points

Just to add on to this, there's pretty much nothing wrong with your code, Alyson (except that you need a space after "let" on your last line). The problem is that the challenge is checking for the full sentence in a constant named "greeting". Your code sets greeting to "Hi there", which is not correct.

You'll see stuff like this a lot - your code is "right" in that it doesn't cause an error or it appears to output the right thing, but if you read the challenge carefully, you're not doing quite the same thing it's asking for. Keep an eye out for that!

Happy coding :sparkles: