iOS Swift Basics Swift Types String Manipulation

Ionut Hanga
Ionut Hanga
1,531 Points

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

// Enter your code below
let name = "Ionut"
let greeting "
Chad Goldsworthy
Chad Goldsworthy
4,207 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!