Outputs text, numbers, or string expressions to the console using the Windows API WriteFile. Handles integers, floating-point values, and string data. Each expression is formatted and written in sequence. The PRINT statement is the primary means of console I/O and is essential for debugging output, status logging, and interactive programs.
Parameters
Parameter
Description
expr
Any expression to output (numeric literal, variable, string, or expression). Multiple expressions are supported.
; (semicolon separator)
Placed between expressions to suppress a newline. The next PRINT or expression continues on the same line.
(no trailing semicolon)
A PRINT statement ending without ; automatically appends a carriage return + line feed (CRLF).
PRINT (alone)
A bare PRINT with no expression outputs a blank line (just CRLF).
Example
FUNCTION PBMAIN() AS LONG
LOCAL x AS LONG
LOCAL name AS STRING
x = 42
name = "PowerBASIC"
' Print a variable with text
PRINT "The value of x is "; x
' Print multiple items on one line
PRINT "Name: "; name; " Value: "; x
' Print blank line
PRINT
' Print without newline (trailing ;)
PRINT "Loading";
PRINT "..."
PRINT "Done!"
FUNCTION = 0
END FUNCTION