Print # statement (LotusScript® Language)

Prints data to a sequential text file.

Syntax

Print # fileNumber , [ exprList ]

Elements

fileNumber

The file number assigned to the file when it was opened. Note that the pound sign (#), the file number, and the comma are all required.

exprList

Optional. A list of string and/or numeric expressions separated by semicolons, spaces, or commas. If you omit exprList, Print # prints a blank line.

Usage

Use Print # only on files opened in Output or Append mode. Unlike the Write # statement, the Print # statement does not separate the printed data items with formatting characters such as commas and quotation marks.

Use the Spc and Tab functions to insert spaces and tabs between data items.

If you set a width for the file using the Width statement, then the following occurs:

  • A comma moves the next print position to the next tab stop. If this moves the print position past the defined width, the next data item is printed at the beginning of the next line.
  • If the current print position is not at the beginning of a line and printing the next item would print beyond the defined width, the data item is printed at the beginning of the next line.
  • If the item is larger than the defined width, it's printed anyway because Print # never truncates items. However, the line is terminated with a newline character to ensure that the next data item is printed on a new line.
Note: Newline does not mean either chr(10) or chr(13) on all platforms. Newline is the character or sequence of characters that is used to mark the end of a line. This may be chr(10), or chr(13), but it may also be something else, because the actual value of newline depends on the platform.

The preceding statements about the effect of the Width statement apply for a width of 0, as well as any positive width.

The following table shows how the Print # statement handles data items specified in exprList.

Data item

Print # statement behavior

variable

Prints the value of the variable.

string

Prints the string.

date/time value

Prints the date as a string in the operating system Short Date and Time format. If either the date part or the time part is missing from the value, only the supplied part is printed.

Variant with the value EMPTY

Prints nothing to the file for the data item.

Variant with the value Null

Prints the string "NULL" to the file.

The following table shows the effect of semicolons and commas in the Print # statement.

Punctuation character

Print statement behavior

Semicolon or space in exprList

The next data item is printed with no spaces between it and the previous data item.

Comma in exprList

The next data item is printed beginning at the next tab stop. (Tab stops are at every 14 characters.)

Example