Specifications
BASIC Stamp II
Page 270 • BASIC Stamp Programming Manual 1.8 • Parallax, Inc.
If...Then
IF
condition
THEN
addressLabel
Evaluate condition and, if true, go to the point in the program marked
by addressLabel.
• Condition is a statement, such as “x = 7” that can be evaluated as
true or false.
• AddressLabel is a label that specifies where to go in the event that
the condition is true.
Explanation
If...Then is PBASIC’s decision maker. It tests a condition and, if that
condition is true, goes to a point in the program specified by an ad-
dress label. The condition that If...Then tests is written as a mixture of
comparison and logic operators. The comparison operators are:
= equal
<> not equal
> greater than
< less than
>= greater than or equal to
<= less than or equal to
The values to be compared can be any combination of variables (any
size), constants, or expressions. All comparisons are performed using
unsigned, 16-bit math. An example:
aNumber var byte
aNumber = 99
IF aNumber < 100 THEN isLess
debug "greater than or equal to 100"
stop
isLess:
debug "less than 100"
stop
When you run that code, Debug shows, “less than 100.” If...Then evalu-
ated the condition “aNumber < 100” and found it to be true, so it










