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 trialMichael Camilleri
1,649 PointsI believe there is an error in this video at about 7:30. '\n' and '\t' aren't string literals, they are escape sequences
See https://en.wikipedia.org/wiki/String_literal#Escape_sequences
Escape sequences are often used in string literals, and may be the sole component of a string literal, but it isn't really accurate to define them simply as such.
1 Answer
Dane Parchment
Treehouse Moderator 11,077 PointsI believe that \t and \n are conscidered string literals because they actually add an ascii character to the string itself. As in \t adds a couple empty strings (spaces), and \n adds a new line character.
I may very well be wrong but, unless a mistake was actually made, I believe that this is a valid reasoning behind the statement.
Michael Camilleri
1,649 PointsMichael Camilleri
1,649 PointsThe video I am referring to is https://teamtreehouse.com/library/swift-basics/types/strings