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

Gean Garcia
Gean Garcia
109 Points

Hi there - my code isn't working. I don't know if I'm doing the Interpolated String thing right.

I followed the model you had set before, and my code was: let name = "Gean" let greeting = "(Hi there, ) (name)"

What's wrong with it? Thanks, Gean

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

1 Answer

Nick Frozz
Nick Frozz
31,289 Points

Hi Gean, To set the value of greeting to an interpolated string you need: 1st- create a constant named "greeting":

let greeting = 

2nd- assign a string with text "Hi there, ":

let greeting = "Hi there, "

3rd step is to add a constant "name" with your name stored in it:

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

And you're done. Your code was almost correct! GL next !)