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 trialJonny Mack
497 Pointswhat am i doing wrong?
I just don't understand
let language = "Swift"
println ("Learning/(language)")
2 Answers
Stone Preston
42,016 Pointsyou need to put a space after learning and use \ to interpolate the language variable, not /
let language = "Swift"
// include a space
println ("Learning \(language)")
interpolation uses a backslash
the reason you include a space after Learning is so the output is "Learning Swift" and not "LearningSwift"
see the Swift eBook for more information on interpolation:
String interpolation is a way to construct a new String value from a mix of constants, variables, literals, and expressions by including their values inside a string literal. Each item that you insert into the string literal is wrapped in a pair of parentheses, prefixed by a backslash:
beven nyamande
9,575 Pointslet language = "Swift" // inferred by type
println("i am doing fine in \(language) ")//interpolation