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

Sean Gilbert
Sean Gilbert
2,186 Points

I can't pass this quiz :( I have tried so many times, and it seems so easy, yet is being awful to complete....

The question states to use string interpolation. I think I am?!? I have no idea, please help..

strings.swift
// Enter your code below
let name = "Sean"
let greeting = "Hi there, Sean"

// Now interpolated string

let interpolatedGreeting = ("Hi there, Sean".)

1 Answer

Marlon Burnett
PLUS
Marlon Burnett
Courses Plus Student 12,917 Points

Hi Sean!

Interpolated strings means you use any expression that results in a string, on the string itself. In this case, the sole constants you have are already strings that you can use for interpolation with the syntax "\(you_variable_constant_or_expression)". An example of string interpolation would be

let myName = "Marlon Burnett"
let myAge = 26

let interpolatedString = "Hi! My name is \(myName). I'm \(myAge) years old!"