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

Brian Moore
Brian Moore
8,277 Points

I don't understand how to assign an interpolated string to the constant greeting

let name = "Brian."

let greeting = "Hi there,"

let interpolatedGreeting = "(greeting) (name)"

strings.swift
// Enter your code below
let name = "Brian Moore"

let gretting = 

2 Answers

You're missing the backslash, try this:

let interpolatedGreeting = "\(greeting) \(name)"

However, if I'm remembering correctly the task calls for you to create the greeting "Hi there, John" which can be done using the code below

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

by the way, more info available here

https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/StringsAndCharacters.html#//apple_ref/doc/uid/TP40014097-CH7-ID285

Brian Moore
Brian Moore
8,277 Points

Yes, thanks for your help!