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

Patrick Lange
Patrick Lange
515 Points

lost

.

strings.swift
// Enter your code below
let name = "Patrick"
let greeting = "Hi there, \(name)."
let finalGreeting = "greeting \(How are you?)"

1 Answer

Keli'i Martin
Keli'i Martin
8,227 Points

You've got the first part done correctly. The finalGreeting gets a little mixed up, but you're close. Remember that the \( ) operator is used to take the value of a variable or constant and insert it into a string. As you have it now, you are surrounding a string with that operator, which doesn't make sense. greeting is the actual constant that you want added to a string. So what change would you need to make to your code to make that happen?

I wanna give you a chance to fix it before giving you the answer. It's the best way to learn! Hope that helps.