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

Stanciu Valentin
Stanciu Valentin
3,281 Points

The editor gives me an error but I've tried the same code in my xCode and it works so maybe it's a problem with this.

Is the editor on TeamTreeHouse faulty ? works in my xCode....

strings.swift
// Enter your code below
let name = "Valentin"
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! Yes, your code works perfectly fine in Xcode, but the purpose of this challenge is to test two separate methods of putting strings together. The first step asks you to use string interpolation, which you did beautifully, but take a look at the instructions for step 2:

Declare a constant named finalGreeting, and concatenate the value of greeting with the string literal " How are you?".

This step requires you to use concatenation. Concatenation uses the + symbol to add two strings together. So while your code does the same thing, it is not done in the same way and thus, will not pass this step.

The last line should be:

let finalGreeting = greeting + " How are you?"

Note that here I'm using concatenation to put the two strings together.

Hope this helps! :sparkles: