I have a completely different explanation than Dim.
I think your issue revolves around the difference between a soft carriage return and a hard carriage return to the program that is automatically formatting your screen.
A hard carriage return always forces a new line, but a soft carriage return could be moved by a text formatter to a different location.
The line of code that caused you the problem was pretty long. If the source editor window was not wide enough to display the entire line, it would insert a soft carriage return in a place it chooses and wrap the line into the next line. It will choose a place that makes sense semantically (i.e. not in the middle of a word or a variable name, etc.)
When you looked at the listing in the book, there is nothing to indicate whether the first line of the print statement has a soft carriage return or a hard carriage return. I am betting that you inserted a hard carriage return after the semicolon, but in the actual code the book was showing, I am betting there was a soft carriage return that was inserted by the code formatter. A soft carriage return affects the display formatting only and is not actually in the source code. In this case, a hard carriage return is syntactically incorrect after the semicolon, and that was the source of the error.
You can see the difference between soft and hard carriage returns for yourself by manipulating the width of your source code window. As you make the window wider hard carriage returns will not be reformatted, however, soft carriage returns will be reformatted.
If you have Microsoft Word, you can clearly see the effect of hard and soft carriage returns by enabling “Paragraph Marks” and then changing the margins in the document.