Punctuation character | Print statement behavior |
Semicolon or space in exprList | The next data item is printed with no spaces between it and the previous data item. |
Semicolon at end of exprList | The next Print statement continues printing on the same line, with no spaces or carriage returns inserted. |
Comma in exprList | The next data item is printed beginning at the next tab stop. (Tab stops are at every 14 characters.) |
Comma at end of exprList | The next Print statement continues printing on the same line, beginning at the next tab stop. (Tab stops are at every 14 characters.) |
In most of my previous code, when debugging, I wrote something like this:
Print "Field contents: " + doc.stringField(0) + ", " & doc.numberField(0)
Using the comma separated syntax, you can get away with:
Print "Field contents:", doc.stringField(0), doc.stringField(0)
I've started using the comma-separated syntax, when debugging, simply because it's less verbose/faster to write.
I did a little test to see how the different "methods" of using Print worked. It seems like the semicolon/comma a the end of the line doesn't work (see picture below). Either that, or I've misunderstood the documentation.
6 comments:
I think the semi-colon at the end is for when you're printing to a file, not the status bar.
That may very well be..
I'll see if I can do a test tomorrow.
This goes way back to the original BASIC. :-) You could format text on the screen by using Print with commas and semicolons. You'd Print stuff in a loop with a comma after it to get columns of data, or print with a semicolon to make it run together.
And I'm not all that old, so don't even go there! I just started young. :-)
What about on the web? What happens there when you print with this syntax?
Same as with printing to the status bar (formatting is only visible in source).
@Julian: I tested printing to a file, using the Print #fileNum,-syntax, and it worked correctly.
I think that means that the documentation is wrong.
Print #.. (Prints data to a sequential text file) only have the semicolon/comma in expression list in the documentation.
Print (Prints data to the screen) has semicolon/comma both at the end of the line/in expression list documented.
Post a Comment