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 Manipulation

What am I doing wrong?

In a playground, this code comes out as the right format. What is wrong with this syntax.

strings.swift
// Enter your code below

let name = "Parker."

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

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Remember that interpolation is the strange combination of backslash and parentheses around a variable/constant name. Here your constant is named name. So that part you did correctly. However, "Hi there," is a string literal and thus doesn't need an interpolation. Interpolation will take the value of name which in your case is "Parker." and put it in the spot where the backslash(name) is. Take a look at what it wants and see if it doesn't clarify things!

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