Contido
Índice 🔎︎

# Instrución Print#

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

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.

### Sintaxe:

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

### Parámetros:

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

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.

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

pos: Spaces are inserted until the specified position.

No caso de haber un punto e coma ou unha coma despois da última expresión a imprimir, LibreOffice Basic almacena o texto nun búfer interno e continúa a execución do programa sen imprimir. Cando encontre outra instrución Print sen punto e coma ou coma no final, o programa imprime o texto dunha soa vez.

As expresións numéricas positivas imprímense cun espazo á esquerda. As negativas imprímense cun signo menos á esquerda. Se o tamaño dun intervalo non é suficiente para valores de punto flotante, a expresión numérica correspondente imprímese en notación exponencial.

Se a expresión que desexa imprimir excede un tamaño determinado, a visualización axústase automaticamente ata a liña seguinte.

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.

### Exemplo:

    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

Temas relacionados

Instrución Close

Instrución Put#

Instrución Open

Instrución Write#