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 trialEric Fox
2,274 PointsVery confused as to why my linking of "how are you" after my greeting constant does not work in this situation?
Can someone tell me what is wrong with this code? It works fine in the compiler...
// Enter your code below
let name = "Eric"
let greeting = "Hi there, \(name)."
let finalGreeting "\(greeting) how are you?"
2 Answers
andren
28,558 PointsThere are two issues:
In the code in your post you have forgotten the = sign in the last line.
The challenge specifically asks you to use string concatenation for the third task, string concatenation is a technique where you use the + operator to combine separate string together. The technique you are currently using is called string interpolation. String concatenation and string interpolation are two different techniques that results in the same thing. So visually the result won't be any different, but for the purposes of this task you have to use string concatenation for the code to pass.
So instead of placing greeting
inside the string you have to use + to combine it with " How are you?"
like this:
let name = "Eric"
let greeting = "Hi there, \(name)."
let finalGreeting = greeting + " How are you?"
Jose Portuondo-Dember
iOS Development Techdegree Student 5,275 Pointsyou are missing an "=" in your last command. It should read: let finalGreeting = "(greeting) how are you?"
Jose Portuondo-Dember
iOS Development Techdegree Student 5,275 PointsJose Portuondo-Dember
iOS Development Techdegree Student 5,275 Pointsyou are missing an "=" in your last command. It should read: let finalGreeting = "(greeting) how are you?"