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

Jahaziel Vazquez
Jahaziel Vazquez
112 Points

Can't find the error! please help. let name = "Jahaziel" let greeting = "\(Hi there), \(name)"

The instructions tell me to only use the following 2 strings

let name = "Jahaziel" let greeting = "(Hi there), (name)"

But the "Hi there" is not connected to anything, and that's why I think it's giving me an error, but I don't know what to do about it because that's that what I understand the instructions are telling me. Can someone please help?

strings.swift
// Enter your code below

2 Answers

Charles Kenney
Charles Kenney
15,604 Points

Jahaziel,

You're on the right path, but to implement the greeting string, you need to use string interpolation. Any time you want to include one string in another: you encapsulate the identifier of the string in a pair of parentheses and escape it by putting a backslash in front (like this \(myString)). So to interpolate your name into the greeting string it should look like this:

let name = "Jahaziel"
let greeting = "Hi there, \(name)"

Hope this helps,

Charles

Jahaziel Vazquez
Jahaziel Vazquez
112 Points

let name = "Jahaziel" let greeting = "Hi there, (name)"