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 trial

iOS Swift Basics (retired) Types Printing Results

what am i doing wrong?

I just don't understand

println.swift
let language = "Swift"
println ("Learning/(language)")

2 Answers

Stone Preston
Stone Preston
42,016 Points

you 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:

let language = "Swift" // inferred by type
println("i am doing fine  in \(language) ")//interpolation