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 trialBrian Uribe
3,488 PointsWhat is wrong with this code?
I'm trying to figure out what is wrong with this code?
let name = "Brian."
let greeting = "Hi there, \(name)"
let finalGreeting = "greeting + "" How are you?"
2 Answers
Marc Schultz
23,356 PointsYou have too much quotation marks inside this:
let finalGreeting = "greeting + "" How are you?"
The variable greeting
should not be surrounded by quotation marks.
let finalGreeting = greeting + " How are you?"
Brian Uribe
3,488 PointsI guess I didn't read the first response carefully enough, I got it to work.
Jason Anders
Treehouse Moderator 145,860 PointsAll's good. As long as you got it to work.
Brian Uribe
3,488 PointsBrian Uribe
3,488 PointsI tried it without the quotes. I was using the quotes to create a space between the two pieces of text. It still didn't work.
Jason Anders
Treehouse Moderator 145,860 PointsJason Anders
Treehouse Moderator 145,860 PointsI just ran Marc's corrections and both tasks passed. Your code for task one is correct
And Marc's correction is correct for task 2
let finalGreeting = greeting + " How are you?"
For task 2, make sure you are adding the line of code to the ones you've already entered... don't delete anything.
:)