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 trialViktor Ilvonen
2,343 PointsSwift 3.0 Basics: Concatenate strings
This Challenge must be bugged xD What am i doing wrong... please help.
- Thank you!
let name = "Alexandra"
let greeting = "Hi there, \(name)"
let finalGreeting = "\(greeting) \(name), How are you?"
// OR
let name = "Alexandra"
let greeting = "Hi there,"
let question = ".How are you?"
let finalGreeting = greeting + ", " name + ", " + question
// What is the right way of doing it ??
1 Answer
Thomas Dobson
7,511 Points// Enter your code below
let name = "Tom"
let greeting = "Hi there, \(name)" //use string interpolation to add string name to greeting.
let finalGreeting = greeting + " How are you?" //concatenate greeting with " How are you?"
I hope this helps.
Viktor Ilvonen
2,343 PointsViktor Ilvonen
2,343 PointsIt did help. Thanks.