5: BASIC Stamp Command Reference – IF…THEN
BASIC Stamp Programming Manual 2.0c
•
www.parallaxinc.com
•
Page 149
IF…THEN
BS1 BS2 BS2e BS2sx BS2p
IF
Condition
THEN
Address
Function
Evaluate Condition and, if it is true, go to the point in the program marked
by Address.
•
Condition
is a statement, such as “x = 7” that can be evaluated as
true or false. The Condition can be a very simple or very complex
relationship, as described below.
•
Address
is a label that specifies where to go in the event that
Condition is true.
Quick Facts
BS1
BS2, BS2e, BS2sx and BS2p
Comparison
operators
=, <>, >, <, >=, <=
=, <>, >, <, >=, <=
Conditional
logic operators
AND, OR
NOT, AND, OR, XOR
Format of
condition
Variable Comparison Value
;where Value is a variable
or constant
Value1 Comparison Value2
;where Value1 and Value2 can by
any of variable, constant or
expression
Parentheses
Not Allowed
Allowed
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 address
label. The condition that IF...THEN tests is written as a mixture of
comparison and logic operators. The available comparison operators are:
Comparison Operator
Symbol
Definition
=
Equal
<>
Not Equal
>
Greater Than
<
Less Than
>=
Greater Than or Equal To
<=
Less Than or Equal To
Comparisons are always written in the form: Value1 Comparison Value2.
The values to be compared can be any combination of variables (any size),
1
2
e
2
sx
2
p
2
Table 5.23: IF…THEN Comparison
Operators.
NOTE: On the BS1, expressions
are not allowed as arguments.
Also, the Value1 (to the left of
comparison) must be a variable.
NOTE: Expressions are not allowed
as arguments on the BS1. The
range of the Pin argument on the
Table 5.22: IF…THEN Quick Facts.
Содержание BASIC Stamp 1
Страница 1: ...BASIC Stamp Programming Manual Version 2 0c...
Страница 30: ...Introduction to the BASIC Stamps Page 28 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 34: ...Quick Start Guide Page 32 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 90: ...BUTTON BASIC Stamp Command Reference Page 88 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 118: ...END BASIC Stamp Command Reference Page 116 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 128: ...FREQOUT BASIC Stamp Command Reference Page 126 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 196: ...NAP BASIC Stamp Command Reference Page 194 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 206: ...OWIN BASIC Stamp Command Reference Page 204 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 214: ...OWOUT BASIC Stamp Command Reference Page 212 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 216: ...PAUSE BASIC Stamp Command Reference Page 214 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 226: ...POLLMODE BASIC Stamp Command Reference Page 224 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 232: ...POLLOUT BASIC Stamp Command Reference Page 230 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 236: ...POLLRUN BASIC Stamp Command Reference Page 234 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 240: ...POLLWAIT BASIC Stamp Command Reference Page 238 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 262: ...RCTIME BASIC Stamp Command Reference Page 260 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 274: ...RUN BASIC Stamp Command Reference Page 272 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 310: ...SEROUT BASIC Stamp Command Reference Page 308 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 324: ...STOP BASIC Stamp Command Reference Page 322 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 340: ...ASCII Chart Page 338 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 342: ...Reserved Words Page 340 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 346: ...Conversion Formatters Page 344 BASIC Stamp Programming Manual 2 0b www parallaxinc com...