Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Swift

Ashleigh Davis
seal-mask
.a{fill-rule:evenodd;}techdegree
Ashleigh Davis
Full Stack JavaScript Techdegree Student 849 Points

please help with the second part of the code challenge on basics of swift

I am on the second part of the code challenge at the beginning of swift basics and I can not figure out what im doing wrong. Example: "Hi there, Pasan. How are you?"

let name = "Ashleigh"
let interpolatedGreeting = "Hi there"
let finalGreeting = "How are you?"

let greeting = "\interpolatedGreeting), \(name), \(finalGreeting)" //wrong code- it says to make sure the value you are assigning is greeting to an interpolated string.

I am confused

3 Answers

Michael Hulet
MOD
Michael Hulet
Treehouse Moderator 47,830 Points

In addition to my first answer, it looks like the challenge asks you to set finalGreeting not just to the string literal "How are you?", but to the whole value of concatenating the value of greeting with the string literal ". How are you?". Once you fix that along with the issue in my original answer, your code passes the challenge just fine for me. Great job!

Michael Hulet
MOD
Michael Hulet
Treehouse Moderator 47,830 Points

I'm not sure specifically which challenge you're referring to, so it'd be helpful if you could link it, but the only major issue I see with your code right now is that you're missing the opening paren (() before interpolatedGreeting in your string. As your code stands right now, your code will crash, because it thinks that \i is meant to be an escape sequence (like \n or \()), but \i is not one of the valid sequences. If you're having trouble past there, it's probably just punctuation