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

I am stuck here, please help. I have a feeling that my code is correct.

The bummer's output: "Make sure the value of finalGreeting matches requirements specified in the question!". I made sure every dot is in correct place. Please help me!

strings.swift
// Enter your code below
let name = "Linda"
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, but in your last line, you have the word "greeting" inside of double quotes. Doing so makes it a string literal. This means, that currently, the value of finalGreeting is this string: "greeting. How are you?" instead of "Hi there, Linda. How are you"?

Removing the quotes from around greeting turns it back into the variable and the concatenation will be done on the string currently in the variable.

Also, to make your code a bit more concise, you didn't need two concatenations afterwards.

let finalGreeting = greeting + ". How are you?"

Hope this helps! :sparkles: