BaStC‖Print# Statement

Contents
cRTEe‖

# AuF5o‖Print# Statement

ZDGAu‖Outputs the specified strings or numeric expressions to the screen or to a sequential file.

ZxhkF‖Use Put# statement to write data to a binary or a random file. Use Write# statement to write data to a sequential text file with delimiting characters.

### FVEx2‖Syntax:

AhB82‖

    99bmh‖Print [#filenum,] expression1[{;|,} [Spc(number As Integer);] [Tab(pos As Integer);] [expression2[...]]

### WADQ4‖Parameters:

y8FDG‖ filenum: Any numeric expression that contains the file number that was set by the Open statement for the respective file.

noGfC‖ expression: Any numeric or string expression to be printed. Multiple expressions can be separated by a semicolon. If separated by a comma, the expressions are indented to the next tab stop. The tab stops cannot be adjusted.

vZ7oY‖ number: Number of spaces to be inserted by the Spc function.

A9EiS‖ pos: Spaces are inserted until the specified position.

GiAKc‖If a semicolon or comma appears after the last expression to be printed, LibreOffice Basic stores the text in an internal buffer and continues program execution without printing. When another Print statement without a semicolon or comma at the end is encountered, all text to be printed is printed at once.

GmqpS‖Positive numeric expressions are printed with a leading space. Negative expressions are printed with a leading minus sign. If a certain range is exceeded for floating-point values, the respective numeric expression is printed in exponential notation.

yiP5A‖If the expression to be printed exceeds a certain length, the display will automatically wrap to the next line.

PV3cE‖You can insert the Tab function, enclosed by semicolons, between arguments to indent the output to a specific position, or you can use the Spc function to insert a specified number of spaces.

### EFSA4‖Example:

    Sub ExamplePrint
        Print "ABC"
        Print "ABC","123"
        i = FreeFile()
        Open "C:\Users\ThisUser\Temp.txt" For Output As i
        Print #i, "ABC"
        Close #i
    End Sub

    Sub ExamplePrint
        Print "ABC"
        Print "ABC","123"
        i = FreeFile()
        Open "~/temp.txt" For Output As i
        Print #i, "ABC"
        Close #i
    End Sub

Related Topics

Close Statement

Put# Statement

Open Statement

Write# Statement

Please support us!