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 trialKim Fook Lo
304 PointsChallenge Task 2 of 2
I don't really don't understand this question,
Declare a constant named finalGreeting, and concatenate the value of greeting with the string literal " How are you?".
Example: "Hi there, Pasan. How are you?"
// Enter your code below
let name = "Lo"
let greeting = "Hi there, \(name)"
let finalGreeting = "greeting + ". " + How are you?"
2 Answers
Matthew Long
28,407 PointsYou're on the right track! But your quotes are in the incorrect location.
let name = "sawsan"
let greeting = "Hi there, \(name)"
let finalGreeting = greeting + ". How are you?"
Anything inside quotes is a string. This means variables and operators such as +
will not be evaluated. Unless you use interpolation like you did in the first task. However, task two is looking for string concatenation so interpolation will not work for this challenge even though it is the preferred method by many!
Also, you don't have to post your question 4 times. Not a ton of people respond to iOS development questions on here for some reason, but someone usually gets to it!
Kim Fook Lo
304 PointsHi Matthew, thanks.