After all of the OUTPUT items have been sent and if the statement did not end with a semicolon or comma, then an End-of-Line (EOL) Sequence is sent. The default EOL is CR/LF, but may be redefined in the ASSIGN statement.
The following examples illustrate most of these rules. For the examples, assume that the following lines have first been executed:
REM OUTPUTEX.BAS
DIM R(1),A$(1)[1]
R(0)=-1
R(1)=+1
MAT A$=("A")
ASSIGN @I TO some device
In the Characters Output, the EOL (which defaults to CR/LF), is shown as <eol>, the string item separator (which is CR/LF), is shown as <crlf>. Spaces are shown as underlines, "_", to make them stand out.
In line 70, 1.E+7 is listed in scientific notation because it is outside the range 1E-4 to 1E+6. The numbers are both positive so a leading blank is output before each. The default EOL is output at the end. In line 80, the -1 has no leading space; the space is replaced with a negative sign. And the semicolon between the two numbers suppresses the comma that would normally be output between the two.
In line 90, an array is output. Notice the full array specifier. The comma following the array causes an item separator to be output between each element. The numeric item separator is a comma. Line 120 shows an example of a string item separator, CR/LF. Line 90 also shows that a trailing comma will suppress the EOL.
Line 100 shows that the real and imaginary parts of a complex number are separated by a comma. This line also shows the default rounding of numbers to 12 significant digits. Remember that if the default output formats are not suitable for your application, you may use OUTPUT USING to define your own. Line 110 shows that a semicolon will suppress the comma between the real and imaginary parts. It also shows that a trailing semicolon will suppress the EOL.
Line 120 demonstrates the effect on string output of commas and semicolons. The semicolon suppresses the item separator that would normally follow the "B". The comma causes the normal string item separator, CR/LF, to be output after the "C". And if no semicolon or comma is at the end of the statement, an EOL is output after the final string.
|