Print Command

Purpose

Prints text into the current active Form or Printer object.

Syntax

Print x[,y,a$,...][;]

x,y:aexp
a$:sexp

Description

A Print without any parameters performs a line feed. If PrintScroll = 1 and the cursor is on the last line, the whole screen is moved up by one line. A Print followed by an expression prints this expression at the current cursor position.

Print At, Locate, VTab, and HTab can be used to position the cursor. The strings must be enclosed in quotation marks. Print can be followed by several (different) expressions which must be separated by a comma, a semi-colon, or an apostrophe.

The comma moves the cursor to the next tab position - a column fully divisible by 16. When the last column is reached the cursor is moved to column 17 on the next line. The semi-colon performs the output of expressions without any spaces between them. The apostrophe, however, inserts a space between the expressions. A line feed is performed after each Print except when the last expression is followed by a semi-colon. In such a case the next Print output resumes from the end of the previous one.

All data printed is formatted using the decimal separator according the Mode Using setting. Use the Using function to format the output before printing.

For Boolean data, either True or False is printed. The True and False keywords are translated according to the locale setting for the host application.

A Date is written according the Mode Date setting.

Example

OpenW 1

Local a$, b$

Print 3 * 4 + 12

Print "3 * 4 + 12 = "; 3 * 4 + 12

a$ = "GFA Software Technologies"

b$ = "-BASIC 32"

Print Left$(a$, 3) + b$

Print "A"``Chr$(66)``"C"

Print "a$,b$: "; a$, b$

Remarks

Because the Print method typically prints with proportionally-spaced characters, there is no correlation between the number of characters printed and the number of fixed-width columns those characters occupy. For example, a wide letter, such as a "W", occupies more than one fixed-width column, and a narrow letter, such as an "i", occupies less. To allow for cases where wider than average characters are used, your tabular columns must be positioned far enough apart. Alternatively, you can print using a fixed-pitch font (such as Courier) to ensure that each character uses only one column. Use the Font object to adjust the font settings.

See Also

PrintAt, Using, Write, Text, Mode

{Created by Sjouke Hamstra; Last updated: 21/10/2014 by James Gaite}