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 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