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 trialDan S
1,166 PointsIn the example, for number in 1..<10 { println("\(number) times 2 is \(number*2)") what does backslash mean?
I am just wondering what the backslash means? I don't recall learning what the backslash does in the println function. Could you please explain what it does? Thanks.
2 Answers
Kevin Hamil
8,203 PointsIt's called String Interpolation. The slash just tells the compiler that you're inserting a variable in your print string and it should use the variable's value. Must be used with the parenthesis.
Dan S
1,166 PointsThank you! I got it now!