print statement QBASIC
print statement QBASIC
A program is of no use unless it can output a result. BASIC uses the PRINT
statement to output information on the output device, generally the
monitor. This statement can be used to print data formatted in different
ways. It can also be used to print a blank line.
E.g. :- PRINT “this is the month of January”
PRINT 23
The PRINT statement can be used to print more than one number,
more than one string or a combination of both numbers and strings.
A semicolon (;) or a comma (,) is used as a separator.
E.g. :- PRINT 23;20
PRINT “India”; ”New Delhi”
PRINT “July”, 2025 , ”Kolkata”
Strings are printed without any spaces between them, whereas a
number is printed with a space before and after it, when semicolon is
used as a separator.
BASIC divides the output screen into 5 zones. Print zones are 14
characters wide. When a comma is used as a separator, the output
information is printed in different zones.
A blank line can be printed using the PRINT statement itself.
E.g. :- PRINT “ HELLO”
PRINT
PRINT
PRINT “WORLD”
Output:
HELLO
…………….
……………...
WORLD
More than one statement can be placed in one line if they are
separated by a colon (;)
E.g. :- PRINT 20 : RPINT 23
Generally PRINT statement takes the cursor to next line. Therefor the
output of the next PRINT statement will be in a next line. But if the
PRINT statement is followed by a semicolon or comma, the cursors
stay on a same line.
E.g. :- PRINT “HELLO” PRINT ”HELLO”;
PRINT “WORLD” PRINT “WORLD”
Output: Output:
HELLO HELLOWORLD
WORD