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

aren polat
aren polat
883 Points

i am stuck in this question

I think i understood the question wrong but im stuck

strings.swift
// Enter your code below
let name = "aren"
let greeting = "\(hiThere,), \(name)"

6 Answers

Patrik Horváth
Patrik Horváth
11,110 Points
// Enter your code below
let name  = "name"
let greeting = "Hi there, \(name)"

I can see that there is abit of confusion in the answering of your question so i'd like to offer my help. I have written out the correct code below and will give it a bit of explanation now.

You have done the code 95% correct but its just the greeting constant that has the error. Only the name should be in brackets. As the greeting constant is a string, you simply write it like a normal string e.g. "Hi There". Then to pull the name constant into the string, you add (name) before you close the string... this would then read as "Hi there, (name)".

''' let name = "Callum" let greeting = "Hi there, (name)" '''

Second statement should be like this, let greeting = " hi There, (name)"

Yes

I mean put (name)

When I try to print backward slash it don't show in my answer. My answer is backward slash and (name) in string.

Patrik Horváth
Patrik Horváth
11,110 Points

use forum CODES its little bit up when you POSTING comment =)