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

sam barlow
PLUS
sam barlow
Courses Plus Student 242 Points

hi, this code worked in x code, but not on the quiz?

hi, this code worked in x code, but not on the quiz?

couldn't understand what you wanted me to do.

I tried using "greeting" instead of "hey"- but x code or you would not accept this

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

1 Answer

Jhoan Arango
Jhoan Arango
14,575 Points

Hello Sam:

What they want you to do here is to declare only 2 constants and not three, and use string interpolation as follows:

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

This will produce the result of, Hi there, Sam.

Good luck with your coding.

sam barlow
sam barlow
Courses Plus Student 242 Points

Thank you jhoan, that was really helpful. Appreciate it!