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 trialScott Becker
20,349 PointsWorks in X-Code preview, but won't let me past in challenge
Is it the closing period stop? where does it go? I tried every place at the end, refused them all.
let name = " Scott Becker" let greeting = "Hi there," let interpolatedGreeting = "(greeting),(name)"
let name = " Scott Becker"
let greeting = "Hi there,"
let interpolatedGreeting = "\(greeting),\(name)"
3 Answers
Steve Hunter
57,712 PointsHi Scott,
I think this is duplicated but I'll have a go anyway!
First the question is First, declare a constant named name and assign to it a String containing your name.
That, for me, looks like:
let name = "Steve"
Then the qustion says, Second, declare a constant named greeting. Set the value of greeting to an interpolated string that combines "Hi there, " with the string stored in the name constant.
That looks like:
let greeting = "Hi there, \(name)"
Lastly, the question is, Declare a constant named finalGreeting, and concatenate the value of greeting with the string literal " How are you?".
That completes the challenge with:
let finalGreeting = greeting + "How are you?"
We need to ignore the stated requirement of a leading space for now - that's a little error!
Hope that helps.
Steve.
Scott Becker
20,349 PointsThanks.. I'm a pixel monkey with aspirations to code, so this is, at times, Greek to me. Thanks!
Steve Hunter
57,712 PointsJust shout if you get stuck - there's always some of us about to help!
Steve.
Scott Becker
20,349 PointsSo Pasan's use of "interpolatedGreeting" as a constant name was demonstrative, not literal? Sometimes I over-think. (Yours was a beautiful, transparent explanation, by the way)
Steve Hunter
57,712 PointsAh, yes. The variable name is freehand.
Keep going and shout if you need help. You can @ mention me if you don't get anywhere. I'm usually around!