PRINT statement

Syntax

PRINT [ON print.channel] [print.list]

Description

Use the PRINT statement to send data to the screen, a line printer, or another print file.

The ON clause specifies the logical print channel to use for output. print.channel is an expression that evaluates to a number from -1 through 255. If you do not use the ON clause, logical print channel 0 is used, which prints to the user's terminal if PRINTER OFF is set (see the PRINTER statement). If print.channel evaluates to the null value, the PRINT statement fails and the program terminates with a run-time error message. Logical print channel -1 prints the data on the screen, regardless of whether a PRINTER ON statement has been executed.

You can specify HEADING statement, FOOTING statement, PAGE statement, and PRINTER statement CLOSE statements for each logical print channel. The contents of the print files are printed in order by logical print channel number.

print.list can contain any BASIC expression. The elements of the list can be numeric or character strings, variables, constants, or literal strings; the null value, however, cannot be printed. The list can consist of a single expression or a series of expressions separated by commas ( , ) or colons ( : ) for output formatting. If no print.list is designated, a blank line is printed.

Expressions separated by commas are printed at preset tab positions. The default tab stop setting is 10 characters. Calculations for tab characters are based on character length rather than display length. For information about changing the default setting, see the TABSTOP statement. Use multiple commas together for multiple tabulations between expressions.

Expressions separated by colons are concatenated. That is, the expression following the colon is printed immediately after the expression preceding the colon. To print a list without a LINEFEED and RETURN, end print.list with a colon ( : ).

If NLS is enabled, calculations for the PRINT statement are based on character length rather than display length. If print.channel has a map associated with it, data is mapped before it is output to the device.

Examples

A=25;B=30
C="ABCDE"
PRINT A+B
PRINT
PRINT "ALPHA ":C
PRINT "DATE ":PRINT "10/11/93"
*
PRINT ON 1 "FILE 1"
* The string "FILE 1" is printed on print file 1.

This is the program output:

55
ALPHA ABCDE
DATE 10/11/93

The following example clears the screen:

PRINT @(-1)

The following example prints the letter X at location column 10, row 5:

PRINT @(10,5) 'X'