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

neil setford-thompson
neil setford-thompson
111 Points

code works on xcode but will not pass the test?

let name = "Neil" let greeting = "Hi there" let interpolatedName = "(greeting), (name)"

result is "Neil" "Hi there" "Hi there, Neil" as far as i can see this is the right code as is works on xcode but then i put it in on the test copy and past so i know its the same its not letting me go on. can any one help.

ADAM SPRINGFIELD
ADAM SPRINGFIELD
310 Points

Heya Neil,

I think it should be:

let interpolatedName = "(greeting), (name)"

Since your interpolating the constants into the string. There are forward slashes "\" proceeding the parentheses () FYI, the comment box is removing them automatically...

3 Answers

Thomas Dobson
Thomas Dobson
7,511 Points

Hey Neil,

You are close! You need to prefix your string literals with a "\". See the below code:

let name = "Neil"
let greeting = "Hi there"
let interpolatedName = "\(greeting), \(name)"
neil setford-thompson
neil setford-thompson
111 Points

let name = "Neil" let greeting = "Hi there" let interpolatedName = "(greeting), (name)"

is that not what i have done?

neil setford-thompson
neil setford-thompson
111 Points

hi thomas i copyed your code and it still comes up with " Bummer! Make sure the value you are assigning to greeting is an interpolated string"

Thomas Dobson
Thomas Dobson
7,511 Points

Hi Neil,

I had to dig up the challenge. Looks like the last task is asking you to concatenate. Hope this helps.

// Enter your code below

//This covers the first task
let name = "Neil"

let greeting = "Hi there, \(name)."

//the second task asks you to concatenate greeting and " How are you?"
let finalGreeting = greeting + " How are you?"