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 Interpolation

String Interpolation challenge - need help

I've tried this multiple times, and I can't figure out the error messages I'm getting. Here's my code:

let name = "Jeff"

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

4 Answers

I am stuck with task 2, I got the first one right. When I use interpolated strings....i was given an error to use concatenation and when I used concatenation ....I get an error as use interpolated strings. While the output on Xcode storyboard is correct and it does not give me any error.

Actually, I ended up getting it.

The "Hi there" was throwing me off. I kept trying to put it in brackets.

The code should have been.

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

When I submit these comments, it's removing the slash before (name).

Lisa Nguyen
Lisa Nguyen
22,731 Points

Same with mine, I thought it was a glitch so I tried deleting the comment to see if it would work the second time round :)

Figured it out! string 1 = name string 2 = greeting interpolatedString = (string 1) (string2) finalGreeting = "(string 1) (string2)" "Greeting string"