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 trialyusuf Dibswazit
1,522 Pointsi did not understand the question on page 2/2 for this task..
code:
let name = "yusuf." let greeting = "Hi there," let interpolatedgreeting = "(greeting) (name)" let finalGreeting = "How are you?" let concatenatedfinalgreeting = interpolatedgreeting + finalGreeting
1 Answer
Nathan Tallack
22,160 PointsSo what they are trying to teach in this challenge is the two ways of manipulating strings. Consider the code below.
let name = "yusuf" // Here you declared your name correctly.
let greeting = "Hi there, \(name)." // The first step they show you interpolation.
let finalGreeting = greeting + " How are you?" // The second step they show you concatenation.
Key takeaways here are:
- When interpolating write the string as normal inside the quotes but remember to escape your values with ().
- When concatenating remember that spaces are not inserted to be sure to include them in the quoted string.
yusuf Dibswazit
1,522 Pointsyusuf Dibswazit
1,522 PointsThank you Nathan for the info... much appreciated.