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

mark hengstebeck
mark hengstebeck
1,119 Points

Swift 3 basics, task 1 of 2. What am I missing here?

// Enter your code below let name = "Mark" let greeting = "Hi there" let interpolatedGreetingName = "(greeting), (name)"

strings.swift
// Enter your code below
let name = "Mark"
let greeting = "\(Hi there)"
let interpolatedGreetingName = "\(greeting), \(name)"

2 Answers

Paul Karim
Paul Karim
3,428 Points

Hey mark! Looks like your syntax is a little off. So what the instructions state is that they want let greeting to be a interpolated string containing your name.

This would be written as such:

let name = "Paul"

let greeting = "Hi there, (name)"

EDIT: For some reason it's not showing up on the answer, but there is a backslash right before (name).

mark hengstebeck
mark hengstebeck
1,119 Points

Thanks Paul,

The backslash did it!

Mark