Beginner's Programming Tutorial in QBasic

(Kiana) #1
NOTE: The asterisk (*) means to multiply two
numbers; the slash (/) means to divide

If you pass an expression to the PRINT command, the value returned (a number) is printed.
Clear the current program, and then run the following:
PRINT 512 + 478
Program output:
990


If you enclose the expression with quotation marks, the expression becomes a string and isn'tevaluated. For example:


PRINT "512 + 478"
Output:
512 + 478


TIP: To clear the output screen, use the CLS
command.
CLS

More about the PRINT command


You can use multiple print statements in your program.
PRINT "Hello"PRINT "World"


Output:
HelloWorld


To place World onto the previous line, place a semi-colon after PRINT "Hello".
PRINT "Hello";
PRINT "World"
Output:
HelloWorld

Free download pdf