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!

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

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,676 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.