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

Malthe Pedersen
Malthe Pedersen
2,338 Points

Swift 2.0 string manipulation

What am I doing wrong?

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

2 Answers

Chris Shaw
Chris Shaw
26,650 Points

Hi Malthe,

Unlike the first part of the challenge which asks you to create an interpolated string, the second part asks that you concatenate greeting with finalGreeting which is achieved by using the plus + operator as shown below.

let finalGreeting = greeting + " How are you?"

Happy coding!

Shreyas Sreenivasa
Shreyas Sreenivasa
7,804 Points

Nothing seems to be wrong in your code. It worked in Xcode.

Adam Blomberg
Adam Blomberg
700 Points

Yeah that's the tricky part, the code works in Xcode but it's not how you're instructed to perform the task. I had problem with this task as well, just be sure to read the instructions evenly.