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 2.0 Basics Swift Types String Manipulation

I am confused is'nt this right

i am confused as heck

strings.swift
// Enter your code below
let name = "Bebas"
let gretting = "Hi there, name"

3 Answers

Peter Michiels
Peter Michiels
3,501 Points

Hi Bebas First, I noticed a typo in the 'Greeting' constant. The code-checking is pretty strict, so make sure you use the exact names used in the task description. Second, the compiler now reads 'name' as a part of the string. Try using

"Hi there, \(name)"

or

"Hi there, " + name

Hopes this helps ;)!

Gr Peter

thanks you so much.

Anjali Pasupathy
Anjali Pasupathy
28,883 Points

To do this challenge, you need to use String interpolation. This is syntax that allows you to insert the value of some variable or constant into a String. Here's an example:

let toBeInterpolated = "interpolated string"
let interpolatedString = "I am an \(toBeInterpolated)."
// interpolatedString = "I am an interpolated string."

In the case of this challenge, toBeInterpolated is name, and interpolatedString is the String that's suppose to look like "Hi there, [INSERT NAME HERE]." Please note that there's a period at the end of the sentence after the interpolated value; you'll need to include that if you want to pass the challenge.

I hope this helps!

thanks man

thanks you so much really appreciated what you did .