Page 26 • BASIC Stamp II Manual 0.94 • Parallax, Inc. • (916) 624-8333
BASIC Stamp II
are resolved left-to-right, parentheses can override priority:
X+1*Y-1
‘something’s wrong here if we need (X+1)*(Y-1)
(X+1)*(Y-1)
‘do it right
Up to 8 levels of parentheses can be used.
For use within conditional expressions (IF), there is a special unary
operator and several binary operators. These conditional operators have
highest priority of all.
NOT
Highest priority unary
AND, OR, XOR
Highest priority binaries
Note: These are arithmetically identical to expression operators:
~
&
|
^
though they differ in application.
Lower-priority conditional binary operators (still higher than expres-
sion ops):
<
Less than
<=
Less than or equal to
=
Equal to
=>
Equal to or greater than
>
Greater than
<>
Not equal
Note: These comparison operators return 0 for false and $FFFF for
true. Combined with NOT, AND, OR, and XOR, complex tests can be
done.
To summarize, here are some examples:
outs = ~ dcd nibarray(index)
‘lookup a nibble, decode it, not it
IF x<1 or not y>3 and (z=0 xor r=3) then loopback
Summary of Contents for BASIC Stamp II
Page 2: ...BLANK PAGE...