Specifications
BASIC Stamp II
Parallax, Inc. • BASIC Stamp Programming Manual 1.8 • Page 273
2
Table I-2. Effects of the Logical Operators Used by
If...Then
Condition A NOT A
false true
true false
Condition A Condition B A AND B
false false false
false true false
true false false
true true true
Condition A Condition B A OR B
false false false
false true true
true false true
true true true
Condition A Condition B A XOR B
false false false
false true true
true false true
true true false
Unlike some versions of the If...Then instruction, PBASIC’s If...Then
can only go to a label as the result of a decision. It cannot conditionally
perform some instruction, as in “IF x < 20 THEN y = y + 1.” The PBASIC
version requires you to invert the logic using NOT and skip over the
conditional instruction unless the condition is met:
IF NOT x < 20 THEN noInc ' Don't increment y unless x < 20.
y = y + 1 ' Increment y if x < 20.
noInc: ... ' Program continues.
You can also code a conditional Gosub, as in “IF x = 100 THEN GOSUB
centennial.” In PBASIC:
IF NOT x = 100 then noCent
gosub centennial ' IF x = 100 THEN gosub centennial.
noCent: ... ' Program continues.










