Submitted By: Jovelle D. Luzon Dianne Myrell V. Sandoval Submitted To: Mr. Angel Corona
Submitted By: Jovelle D. Luzon Dianne Myrell V. Sandoval Submitted To: Mr. Angel Corona
The PRINT command tells the QBasic interpreter to print something to the screen. In this
case, the interpreter printed “Hello World!”.
ADVANCED TIP: Although you don’t
normally need to, you can find the actual
memory address of a variable (x, for example)
by using the VARSEG and VARPTR
commands.
The OR operator only requires one expression to be true in order to print “Yes” in the following
program:
x = 20
IF (x = 5 OR x = 20) THEN PRINT “Yes”
Output:
Yes
The AND operator requires both expressions to be true.
x=7
IF (x > 5 AND x < 10) THEN PRINT “True”
Output:
True
This is a slightly more complex examples:
x = 16
y=3
IF ((x > 5 AND x < 10) OR y = 3) THEN PRINT “Correct”
Output (since Y is 3):
Correct
Strings in IF. . .THEN
So far this chapter, we’ve only been dealing with
numbers, but you can also use strings with the IF. .
.THEN command.
x$ = “Hello”
IF (x$ = “Hello” OR x$ = “World”) THEN PRINT x$
Output:
Hello
Jovelle D. Luzon
Dianne Sandoval