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

Cannot complete Challenge task 2/2 in Swift 3 Basics

I have checked the code in XCode and it is correct. Not sure what is wrong......

strings.swift
// Enter your code below

let name = "Eugene"
let greeting = "Hi there, \(name)"
let finalGreeting = "\(greeting). How are you?"

1 Answer

andren
andren
28,558 Points

The challenge instructions specify that you have to use string concatenation when creating the finalGreeting constant. String concatenation is where you combine separate strings using the + operator. The technique you currently use in your solution is called string interpolation. The resulting string will end up being the same regardless of what technique you use, but the challenge will only accept string concatenation for this task, since Treehouse is testing your knowledge in the various ways of combining strings and variables/constants.

So to solve the challenge you have to combine the greeting constant and the " How are you?" string using the + operator, which you were thought about in the video preceding this challenge.

Thank you for the answer, I have already completed the task. Read the instructions again and figured it out ;)

Please provide a Best Answer. This can help Treehouse's community filter and it also will give the person who gets the best answer 12 forum points for that topic.

Tagging William Li who always is willing to help (thanks William! :smile:)