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 Basics Swift Types String Manipulation

Pankha Singh
Pankha Singh
1,152 Points

how do I do this

whatever I do. this won't let me pass

// Enter your code below
let name = "Pankha"
let greeting = " Hi ther, \(name) "

1 Answer

Matt Skelton
Matt Skelton
4,548 Points

Hey Pankha,

The compiler is pretty strict and requires you to assign very specific values to your variables.

As an example, the final value of greeting could be "Hi there, Linda".

So, we're trying to achieve a string with the value of "Hi there, Pankha". Compare that to what you currently have, which is " Hi ther, Pankha ".

Notice the extra spaces at the start and end of the string? They'll cause you problems. Finally, correct the typo to 'there', and you'll be good to go. Just bear this sort of thing in mind when tackling future challenges, as it's a common issue that may trip you up!

Good luck!