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

How to do this exercise? I can't understand

I understand how to create the constant with my name but i don't understand what kind of value need the constant greeting

strings.swift
// Enter your code below
let name = "Ionut"
let greeting "
Chad Goldsworthy
Chad Goldsworthy
4,209 Points

Can you post the full question?

1 Answer

Jorge Solana
Jorge Solana
6,064 Points

Hi there Ionut!

The challenge is asking you to assign a bigger String message to it. One way you can do it is by concatenating the value of "Hi there, " to your name constant, as in:

let greeting = "Hi there, " + name

Now if you understand that, what the challenge is really asking you to do is to practice the string interpolation, so you don't have to sum or add two or more strings but having that value referenced in the same one and only string. Remember how you can use another variable or constant with interpolation:

"Now there's only one string \(variable)"

Don't be afraid to watch again the previous video to strength your knowledge! Hope it helps!

Thank you