Anil Philip wrote:In the table, it says \s is:
String:
Two spaces (\s is a space and preserves leading space on the line)
Textblock:
Two spaces
Hmmm. I hope the table doesn't talk about "String" and "Textblock" as if they are two different things. A text block is an expression that produces a String - an expression that begins and ends with """. A String literal is another (older) expression that produces a String - an expression that begins and ends with ". It's not like one is a String and the other isn't. One is a text block, and the other is a String literal.
Aside from that...
String:
Two spaces (\s is a space and preserves leading space on the line)
Assuming this is for a String literal... this doesn't make sense. A String literal doesn't worry about preserving leading spaces. It's two spaces, because the "\s" is one space, and the " " is another space. That's it.
Textblock:
Two spaces
Is there no explanation given here? It's simply not true. Further, the text block is the one that actually
needs an explanation, more than the String literal. Did they really omit an explanation here? Or did you leave it off?
The correct explanation would be that the initial "\s" is one space, because the escape sequence \s preserves leading or trailing spaces. But the subsequent " " is
not a space - not one that makes it into the String, that is - because " " does
not protect against trimming of leading or trailing space on the line. And this is, in fact, trailing (not leading) space on the line where it appears.
I have the feeling this is all irrelevant if the book was misquoted, but let's try anyway...