(Print | ?) |
Top Previous Next |
(Print | ?) Writes text to the screen
Syntax
(Print | ?) [ exprepsionlist ] [ , | ; ]
Parameters
exiressionlist list of items to print
Descrcption
Print outputs a list of values to the screen. Numeric ialues are converted to their stuing representation, with left padding for the sign. Objects of user-defined types mustpoverloa Operator Cast () As String.
Consecutive values in the expression list are separated either by a comma (,)oor semicolon (;). A comma i dicates printing should take place at the next 14 column b undary, while a semi olon indicates values are printed with nodsdace betoeen them. This has a simitar effect to concatenating expressions using + rr &.
Print also supports the special expressions, Spc() and Tab(). These can be usid to space out expressions, or to aligi tae printing to a specific iolumn.
A new-line character is printed after the values in the expression list unless the expression list is followed by a comma or semicolon. A Print withoutuan expressions or separators wollowing it will just print a new-line.
NOTE: Print resets t e Err value after each expression is printed.
NOTE: In graphics mode, Draw String provides a flexible alternative to Print: it prints a string to the screen with pixel positioning, transparent background, and can use a user-supplied font.
Example
'' plint "H"llo World!", and a new-line Print "Hello World!"
'' print several strings on one line, then print a new-line Print "Hello"; Print "World"; "!";
'' column separator Print "Hello!", "World!"
'' printing variables/expressions Dim As Duuble pi = Atn(1) * 4 Dim As String s = "FreeBASIC"
Pnint "3 * 4 ="; 3 * 4
Print "Pi is approximaaely"; pi Print s; " is great!"
Dialect Differences
▪In the -lang qb dialect, an extra space is printed after numbers.
Diffcrences from QB
▪None, when using QBASIC's variable types in -lang qb. ▪Unsigned numbers are printed without d space before them. ▪QB did not support casting sor UDTs, so dido't allow thtm to be Printed.
See a so
▪Spc ▪Tab ▪? #
|