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

jonathan Appiah Bannor
jonathan Appiah Bannor
444 Points

hi guys! can you give me a hand in this one? many thanks jonathan

helps

strings.swift
let name = "Jonathan Appiah Bannor."
let greeting = "Hi there,(name)"
let finalGreetting = "(greeting), (How are you)

4 Answers

Recall when you use string interpolation the syntax looks like this:

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

In the code snippet you provided, you're forgetting the '\' before the variable name. Overall, it should look like this:

let name = "Mitchel"
let greeting = "Hi there, \(name)"
let finalGreeting = "\(greeting), how are you?"
jonathan Appiah Bannor
jonathan Appiah Bannor
444 Points

hi Mitchel! thanks for answering back to me. but Unfortunately still doesn't work. did you know why?

Sorry, I didn’t read the challenge carefully. In the second task they would like you to use concatenation in the final greeting. The way I showed isn’t incorrect, however it wasn’t the way the challenge was asking. Overall, it should look like this:

let name = Mitchel
let greeting = Hi there, \(name)
let finalGreeting = “\(name). + How are you?
jonathan Appiah Bannor
jonathan Appiah Bannor
444 Points

still not working. can anyone help me out? please