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

tom shimono
tom shimono
97 Points

I don't know whats wrong. Can someone help?

It is asking me if I did concatenate.

strings.swift
// Enter your code below
let name = "Yoshi"
let greeting = "Hi there, \(name)"
let finalGreeting = "\(greeting). How are you?"

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! You're doing great and in fact, your code would have the same end result as the code it's looking for. The point here is that they want to make sure that you can use multiple methods to achieve the same results. It's always a great thing to have more than one tool in your toolbelt! :smiley:

It's asking you if you used concatenation, because you didn't. Remember interpolation is the using of the backslash and parentheses to insert the value of a variable at that point. Concatenation requires the use of a + sign to squish two strings together. Let's take a look at an example:

let name = "Tom"
let myName = "Jennifer"
let finalGreeting = "Hi, " + name + "!  My name is " + myName

If we were to then print out the value of finalGreeting we'd get "Hi, Tom! My name is Jennifer"

Hope this helps clarify things, but let me know if you're still stuck! :sparkles: