QB64 is a modern extended BASIC programming language that retains QBasic/QuickBASIC 4.5 compatibility and compiles native binaries for Windows, Linux, and macOS.

The PRINT statement prints numeric or string expressions to the program screen. Typing shortcut ? will convert to PRINT.


PRINT [expression] [; ,] [expression…]




Using semicolons, comma tabs or concatenation to insert ASCII characters and numbers in a PRINT:

PRINT CHR$(34); "Hello world!"; CHR$(34) ' adding quotation marks
PRINT 123 'demonstrates the positive leading space
a$ = "Hello country!": a = 321: b = -321
PRINT a$, a ' demonstrates comma in statement
PRINT a$; a ' demonstrates semicolon in statement
PRINT a$ + STR$(b) ' concatenation of string numerical values only
? "Hello city!" ' a ? changes to PRINT after moving cursor from the code line in IDE

"Hello world!"
Hello country!      321
Hello country! 321
Hello country!-321
Hello city!

First PRINT prints the text between two quotation marks, then it prints the value 123, notice that there are no quotation marks when printing the value, quotation marks mean that it will be treated like a literal string of text. a$ is set to “Hello country” and ‘a’ is set to the value 321, the dollar sign is used when a variable holds the text string. The contents of a$ is then printed and the “,” means that the value of ‘a’ is printed separated by a tab and “;” means that there is no separation from the other text except for the leading positive value space.

Changing colors in a line of text using semicolons with colon separators between PRINTs on the same code line.

COLOR 12: PRINT "Start red "; : COLOR 10: PRINT "and end green."
COLOR 11: PRINT "Start aqua ";
COLOR 14: PRINT "and end blue."

Start red and end green.
Start aqua and end blue. 

See Also