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.

iOS Swift 2.0 Basics Swift Types String Manipulation

no sure what i'm doing wrong

let name = "Jon"
let greeting = "How are you?"

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

3 Answers

You want to use concatenation for the last part of the challenge, i.e. add the strings together:

// Enter your code below
let name = "Jon"
let greeting = "Hi there, \(name)."
let finalGreeting = greeting + " How are you?"

(Remember the space in front of How)


It took me far too long to read the question and notice why my code wasn't working!!

Hi Jon,

You need to be pretty prescriptive and follow the output that the challenge wants precisely else it'll fail you:

// Enter your code below
let name = "Jon"
let greeting = "Hi there, \(name)"

That should get you through the first bit. It is expecting that output, not the extra bit you added, that's all.


ok thanks

My apologies, I didn't help you with the right bit of the code challenge there. That's my fault for rushing!!

Let me try that again - I'll edit this post in a minute.


No problem i was just about to say that, hehe. Thanks for the help