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 trialYasser Shaaf
UX Design Techdegree Student 13,865 PointsHelp !
Help !
let language : String = "LearingSwift "
println ("LearingSwift ")
2 Answers
Tobias Helmrich
31,603 PointsHey Yasser,
in this challenge you have to use string interpolation which means that you have to print "Learning Swift" by interpolating the constant language that contains "Swift". The constant already exists so you shouldn't remove it and you don't have to create it yourself. The only thing you have to do is write the println statement and print out the string with "Learning" and the interpolated constant. You interpolate a constant/variable by writing it inside of \()
.
It should look like this then:
let language = "Swift"
println("Learning \(language)")
I hope that helps, good luck! :)
Steve Hunter
57,712 PointsHi Yasser,
The challenge wants you to use string interpolation to complete the string "Learning Swift" with the existing constant language
. Strings can be interpolated by surrounding the name in backets and preceding those with a backslash. This inserts the contents of the constant or variable into the string being used. Something like this:
let language = "Swift"
println("Learning \(language)")
So, language
holds "Swift" and we insert the contents of language
with the brackets and backslash. The output string will be "Learning Swift".
Make sense?
Steve.