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

Yvon Joseph
seal-mask
.a{fill-rule:evenodd;}techdegree
Yvon Joseph
iOS Development Techdegree Student 201 Points

What am I doing incorrectly here with this task ?

I wrote the code in Xcode to have no errors. I have tried both string concatenation and string interpolation, but im getting an error saying to use an interpolated string.

Please help

strings.swift
let name = "Pasan. How are you?"
let greeting = "Hi there"
let finalGreeting = "\(greeting), \(name)"

1 Answer

For your second constant, greeting, you are supposed to pass in the the value of 'name' using string interpolation, then use the greeting constant again in a new constant 'finalGreeting'.

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

let finalGreeting = greeting + " How are you?"