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 trialMichael Zarucki
803 PointsWhat have I done incorrectly here?
What have I done incorrectly here? I can not seem to pass any challenge without any help. Is that normal?
// Enter your code below
let name = "Michael Zarucki"
let greeting = "Hi there, \(name)"
let finalGreeting = " \(greeting), How are you?"
1 Answer
andren
28,558 PointsIt's pretty normal to struggle a bit in the beginning, especially if you have never had any experience with programming before now, as you get farther into the course and get more used to how things work you will likely have less issues.
It is also worth noting that Treehouse's challenges are not always worded super clearly, and the challenge checker that verify your code can be very picky, so your code being marked as wrong does not always mean that you have made some huge mistake. Often times it can be a very simple thing that the challenge checker is getting hung up on that would not be an issue if you were coding an application on your own.
Anyway the problem with your code in this instance is that Treehouse does not want you to use string interpolation for this final task. They specifically want you to use string concatenation instead. String concatenation is where you combine seperate strings and variables/constants together using the + operator. This technique was shown off in the last video along with the string interpolation technique.
So to solve this challenge you have to combine the greeting
constant and the " How are you?" string using the + operator. Like this:
let finalGreeting = greeting + " How are you?"
The result of using string concatenation instead of string interpolation is not really any different, they both result in a string with the content of greeting combine with the text "How are you?" so your code is not technically wrong. It's just a case of the challenge being very picky about exactly how you achieve the requested result.