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 trialMatt Conway
1,572 PointsConcatenated
/Users/mattconway/Desktop/Screen Shot 2016-01-07 at 10.24.15 AM.png
What in the world am I doing wrong?
// Enter your code below
let name = "Matt"
let greeting = "Hi there"
let interpolatedgreeting = "\(greeting), \(name)."
let finalGreeting = "How are you?"
let concatenatedfinalGreeting = greeting + ", " + name + ". " + finalgreeting + "?"
2 Answers
Matt Conway
1,572 PointsThanks for your help. I still have some learning to do, still not quite used to it .......
Michael Reining
10,101 PointsHi Matt,
Combining the strings can be done a bit simpler which is what the code challenge is looking for in terms of an answer.
For part 1, all you needed is this.
let name = "Matt"
let greeting = "Hi there, \(name)."
// there is no need for two interpolated strings like in your example
For part 2, just combine the greeting constant with the new string like this.
let name = "Matt"
let greeting = "Hi there, \(name)."
let finalGreeting = greeting + "How are you?"
I hope that helps,
Mike
PS: Thanks to the awesome resources on Team Treehouse, I launched my first app.
Now you can practice writing Swift code directly on your iPhone :-)