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 trialTatenda Madzokere
2,970 Pointsi seem to have a problem with the interpolation question on swift , i dont know where im getting it wrong
i have tried
let name ="Brian"
let greeting = "Hi there, \(name)
its not working please help
[MOD: edited code block - srh]
4 Answers
Steve Hunter
57,712 PointsHi!
You need to close the string with another " mark at the end:
let greeting = "Hi there, \(name)" // <- that's missing!
Steve.
joe Bell Fenner
Courses Plus Student 2,646 Pointsthis aint working for either I'm still getting " Bummer! Make sure the value you are assigning to greeting is an interpolated string"
Steve Hunter
57,712 PointsShow me your code, Joe!
joe Bell Fenner
Courses Plus Student 2,646 Pointssorry I dont know how to include the screen shot. but anyway I typed the following..
let name = "Joe"
let greeting = "Hi there, \(name)"
also tried..
let greeting: String = "Hi there, \(name)"
let greeting = "Hi there," " \(name)"
let greeting = "\(Hi there), \(name)"
let greeting = "\(Hi there,)" "\(name)"
let greeting: String = "\(Hi there), \(name)"
let greeting: String = "\(Hi there)", "\(name)"
let greeting: String = "\(Hi there,)" "\(name)"
all sorts of variants.
Steve Hunter
57,712 PointsHi Joe,
I think you start with creating a name
constant:
let name = "Joe"
Then you want to interpolate name
into a greeting
constant (just like you've done in your first lines?!):
let greeting = "Hi there, \(name)"
However, I've just tried this and it isn't working - this is the third Swift issue I've come across tonight - I think there may be an issue with the challenge. Let me get hold of support ...
Steve.
joe Bell Fenner
Courses Plus Student 2,646 Pointsif you look at my previous reply I did type
let name = "Joe" the greeting is what I changed to try variants of syntax. I just left out, let name = "Joe" to keep the message/reply short.
Steve Hunter
57,712 PointsYep - I can see that you've solved the challenge correctly but highlighted that there's an issue with the Swift backend at the moment; I have advised Support.
Steve Hunter
57,712 PointsMessage from TTH Support:
*This is confirmed by our developers as a bug on our end, and we hope to have a fix by the end of the day. *
Steve Hunter
57,712 PointsJennifer Schultz yes, it was fixed the same evening. I hope you got going again; I assume you did as your comment has gone.
Raphael Reiter
6,820 PointsRaphael Reiter
6,820 PointsHello, you are missing a " after (name) ;-) =
let greeting= "Hi there, (name)"
To avoid this problem in the future, I have a little trick, i always put the 2 "" and then write in the middle. same for () and {} and []