VTech Precomputer Power Pad Plus Games User Manual


 
59
Example:
40 IF P=6 THEN PRINT “TRUE” ELSE PRINT “FALSE”
In this example, if P=6 the computer will print TRUE. Any other value will print FALSE.
In either case the computer will carry onto the next line.
It is possible for more than one statement to follow the THEN or ELSE command. A colon
separates the statements.
Example:
50 IF A =5 THEN PRINT “TRUE”: S=S-3:
GOTO 90 ELSE PRINT “FALSE”: K=K+8
So if A equals 5 the computer will print TRUE, subtract 3 from the variable S and go to
line 90. If A does not equal 5 the computer will print FALSE, add 8 to the variable K
and then carry on with the next normal line.
LOGICAL OPERATORS
Logical operators are used IF...THEN...ELSE and such statements where a condition is used
to determine subsequent operations within the user program. The logical operators are:
AND, OR, and NOT.
For the purpose of this discussion, A and B are relational expressions having only TRUE
and FALSE. Logical operations are performed after mathematical and relational operations.
Operator Example Meaning
NOT NOT A If A is true, NOT A is false.
AND A AND B A AND B has the value true, only if A and B
are both true.
A AND B has the value false if either A or B
is false.
OR A OR B A OR B has the value true if either A or B or
both are true.
It has the value false if both are false.