PRINT Statement

PRINT {#ch} {USING mask}{delimiter} expr{delimiter expr delimiter...}

PRINT outputs the specified material to file or screen.

ch is an integer expression specifying the file channel on which the file was opened. If not specified, or zero, output is to the terminal.

USING mask may specify a format mask for the entire print operation, which must include format specifiers for each expression listed in the statement.

Each expression is a numerical or string expression, which may include a USING mask clause for formatting that one expression.

Each delimiter may be either a space, comma or semicolon. A space simply outputs a space. A semicolon outputs nothing beyond the preceding expression—i.e. stops the cursor just past the output of the expression. A comma adds several spaces following the preceding expression, unless a format mask was specified prior to the first expression, in which case commas are used simply to delineate the expressions so they can be matched up with the corresponding format specifiers in the mask. The last delimiter is optional. If omitted, a line terminator (CRLF or LF) is output.

Comments

The statement token "PRINT" may be replaced by the equivalent "?" for brevity.

Print Tab() Functions are often used as expressions within PRINT statements, particularly for screen output. For file output, only one dimensional tabs are meaningful.

PRINT statements are somewhat unusual in that they take a variable number of expressions as arguments. A PRINT statement with multiple arguments can be broken up into multiple PRINT statements with the same overall result. Alternatively, instead of using the delimiters to separate multiple expression arguments, you can use string concatenation to combine them all into a single string expression.

Three variations of PRINT are DPRINT, EPRINT and TPRINT, all of which has the identical syntax but are only applicable for screen printing in a GUI environment. All three use the current default proportional font instead of the standard fixed-pitch text mode font. DPRINT adds a sunken panel effect and is typically used for displaying static data fields. EPRINT embeds the output fields in edit boxes, typically used for displaying editable data fields. For outputting to GUI screens you can also use AUI_CONTROL .

Examples

PRINT "Hello world"

? #7, CITY$;", ";STATE$;" ";ZIP$

? #7, CITY$ + ", " + STATE$ + " " + ZIP$ ! same result as preceding statement

? #CHREP USING "###. /---description ---/ $###,###.##", QTY, DESCR$, QTY*PRICE

print tab(r,c);"Enter name: "'; tab(r,c+30);"Age: ";

Print (A using MASK1$) (B using MASK2$)

 

See Also

TRACE.PRINT: output to debug window

DEBUG.PRINT: output to debug window if DEBUG mode

• WRITECD (following topic): comma delimited file output

USING Mask