Specifications
BASIC Stamp II
Page 272 • BASIC Stamp Programming Manual 1.8 • Parallax, Inc.
false. The following If...Thens are equivalent:
IF x <> 100 THEN notEqual ' Goto notEqual if x is not 100.
IF NOT x=100 THEN notEqual ' Goto notEqual if x is not 100.
The operators AND, OR, and XOR join the results of two conditions to
produce a single true/false result. AND and OR work the same as they
do in everyday speech. Run the example below once with AND (as
shown) and again, substituting OR for AND:
b1 = 5
b2 = 9
IF b1 = 5 AND b2 = 10 THEN True ' Change AND to OR and see
debug "Statement was not true." ' what happens.
stop
True:
debug "Statement was true."
stop
The condition “b1 = 5 AND b2 = 10” is not true. Although b1 is 5, b2 is
not 10. AND works just as it does in English—both conditions must be
true for the statement to be true. OR also works in a familiar way; if
one or the other or both conditions are true, then the statement is true.
XOR (short for exclusive-OR) may not be familiar, but it does have an
English counterpart: If one condition or the other (but not both) is true,
then the statement is true.
Table I-2 below summarizes the effects of the logical operators. As with
math, you can alter the order in which comparisons and logical opera-
tions are performed by using parentheses. Operations are normally
evaluated left-to-right. Putting parentheses around an operation forces
PBASIC2 to evaluate it before operations not in parentheses.










