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

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
Michael Hulet
47,913 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
Michael Hulet
47,913 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

Michael Hulet
Michael Hulet
47,913 Points

Go to the challenge in your web browser, copy the URL that's in the address bar, and paste it here