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

My code error is saying swift_lint.swift:14:20: error: invalid escape sequence in literal println("Learning \ (language)

My code keeps saying swift_lint.swift:14:20: error: invalid escape sequence in literal println("Learning \ (language)") ^ Im sure I put it in correct

println.swift
var str : String = "Learning "

let language: String = "Swift"

var greeting = "\(str) + \(language)" 


println("Learning \ (language)")

1 Answer

Logan R
Logan R
22,989 Points

You added an extra space. The \ has to be up against the (. Just as a note, the \ is used to escape characters, that is why you got an invalid escape error, \ + space is not a valid escape sequence.

var str : String = "Learning "

let language: String = "Swift"

var greeting = "\(str) + \(language)" 


println("Learning  \(language)")