Syntax
|
Print
[[{
Spc
(n) |
Tab
(n)}][expressionlist][{; | ,}]]
|
Description
|
Prints data to an output device.
|
Comments
|
The actual output device depends on the platform on which the Basic Control Engine is running.
The following table describes how data of different types is written:
|
|
Data Type
|
Description
|
|
String
|
Printed in its literal form, with no enclosing quotes.
|
|
Any numeric type
|
Printed with an initial space reserved for the sign (space = positive). Additionally, there is a space following each number.
|
|
Boolean
|
Printed as TRUE or FALSE.
|
|
Date
|
Printed using the short date format. If either the date or time component is missing, only the provided portion is printed (this is consistent with the "general date" format understood by the
Format/Format$
functions).
|
|
Empty
|
Nothing is printed.
|
|
Null
|
Prints NULL.
|
|
User-defined errors
|
Printed as "Error code", where code is the value of the user-defined error. The word "Error" is not translated.
|
|
Each expression in expressionlist is separated with either a comma (,) or a semicolon (;). A comma means that the next expression is output in the next print zone. A semicolon means that the next expression is output immediately after the current expression. Print zones are defined every 14 spaces.
If the last expression in the list is not followed by a comma or a semicolon, then a carriage return is printed to the file. If the last expression ends with a semicolon, no carriage return is printed¾the next
Print
statement will output information immediately following the expression. If the last expression in the list ends with a comma, the file pointer is positioned at the start of the next print zone on the current line.
The
Tab
and
Spc
functions provide additional control over the column position. The
Tab
function moves the file position to the specified column, whereas the
Spc
function outputs the specified number of spaces.
|
Example
|
Sub Main()
i% = 10
s$ = "This is a test."
Print "The value of i=";i%,"the value of s=";s$
'This example prints the value of i% in print zone 1 and s$ in print
'zone 3.
Print i%,,s$
'This example prints the value of i% and s$ separated by 10 spaces.
Print i%;Spc(10);s$
'This example prints the value of i in column 1 and s$ in column 30.
Print i%;Tab(30);s$
'This example prints the value of i% and s$.
Print i%;s$,
Print 67
End Sub
|
Note
|
On Win32, the Print statement prints data to stdout .
|