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 trialUtsah Kapoor
696 PointsI got the correct answer but its not saying its right
So I am in swift 2 basics and I have used the xcode playground and checked. It works but Im some how doing it wrong please help.
Here is my code
let name = "Utsah"
let greeting = "\("Hi there,") \(name)."
2 Answers
William Li
Courses Plus Student 26,868 PointsHi there,
you don't need to enclose the "hi there, " with \()
, this notion is used for injecting variable variable into the String (String interpolation).
let name = "Utsah"
let greeting = "Hi there, \(name)."
This would be suffice.
Krzysztof Kucharzyk
Front End Web Development Techdegree Student 4,005 PointsIn this task I guess you should try using interpolation instead of concatenation. Try with this code below:
let name = "Utsah"
let hello = "Hi there"
let greeting = "\(hello), \(name)."
Utsah Kapoor
696 PointsThanks
Utsah Kapoor
696 PointsUtsah Kapoor
696 PointsThanks, but when I answer the second question in this way I get an incorrect answer.
let name = "bob" let greeting = "Hi there, (name)." let finalGreeting = "(greeting) How are you?"
William Li
Courses Plus Student 26,868 PointsWilliam Li
Courses Plus Student 26,868 PointsYes, second part strictly required that you use String concatenation to combine two string together; that's you need to use the plus sign + to combine 2 strings into one.
Utsah Kapoor
696 PointsUtsah Kapoor
696 PointsThanks