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

Clues please, I can't figure out what I'm missing let name = "Mansa" let greeting = "\("Hi there,"), \(name)"

I'm stuck on the 2nd step of this code challenge, string interpolation. Clues please.

let name = "Mansa" let greeting = "("Hi there,"), (name)"

strings.swift
// Enter your code below
let name = "Mansa"
let greeting = "\("Hi there,"), \(name)"

3 Answers

Xavier D
PLUS
Xavier D
Courses Plus Student 5,840 Points

Hi,

I see that your second constant has one too many commas. Try removing one from either inside the first string interpolation, or the one just after the first string interpolation, or just remove the first string interpolation from the first string from the second constant altogether and concatenate the second constant's first string with it's second string in the second interpolation that has your first constant passed in.

Hope this helps...

Thanks for your help! The error was coming from the extra comma.

Mark Carrel
Mark Carrel
9,873 Points

Hi Mansa,

You asked for clues, so hopefully I won't give away too much but I think the problem you are having is that you only need to treat the variable, "name" as a string literal by encapsulating just the variable in a "( )". Your code also encapsulates the text, "Hi there," as a string literal and that is probably the source of the error you are seeing.

Thanks for your help!

Giorgos Karyofyllis
Giorgos Karyofyllis
21,276 Points
// Enter your code below
let name = "Mansa"
let greeting = "\("Hi there,") \(name)"
let finalGreeting = greeting + "How are you?"

Thanks!