122-32000 Parallax Inc, 122-32000 Datasheet - Page 223

MANUAL PROPELLER

122-32000

Manufacturer Part Number
122-32000
Description
MANUAL PROPELLER
Manufacturer
Parallax Inc
Datasheets

Specifications of 122-32000

Accessory Type
Manual
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
For Use With/related Products
Propeller Education (PE) Kit
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Here, if
toggled, and if neither of those conditions were true, neither P0 nor P1 is toggled. This is a
slightly shorter way of writing the following code:
Both of these examples perform the same actions, but the first is shorter and is usually
considered easier to read. Note that the
the same column) as the
Each
Look at the following:
We have three conditions and three possible actions here. Just like the previous example, if
is greater than 100, P0 is toggled, otherwise, if
those conditions were true and
were true, then none of those actions would occur.
There is an important concept to note about this example. If
or if
IF
first condition that is true has its block of code executed; no further conditions are tested after
that. This means that if we had rearranged the two
first, we’d have a bug in our code.
if X > 100
else
if X > 100
elseif X == 90
elseif X > 50
and
X
!outa[1]
!outa[0]
if X == 90
!outa[0]
!outa[1]
!outa[2]
IF
is 90, P1 is toggled, or if
ELSEIF
!outa[1]
X
conditional statement can have zero or more
is greater than 100, I/O pin 0 is toggled, otherwise, if
conditions are tested, one at a time, in the order they are listed and only the
IF
that it is associated with.
X
X
is greater than 50, P2 is toggled. If none of those conditions
is 51 to 89, or 91 to 100, P2 is toggled. This is because the
'Toggle P1
'If X is greater than 100
'Toggle P0
'Otherwise,
'If X = 90
'Toggle P1
'If X is greater than 100
'Toggle P0
'Else If X = 90
'Toggle P1
'Else If X > 50
'Toggle P2
ELSEIF
, just like the
4: Spin Language Reference –
X
equals 90, P1 is toggled, but if neither of
ELSEIF
ELSEIF
s so that the “
X
ELSE
Propeller Manual v1.0 · Page 223
is 101 or higher, P0 is toggled,
statements associated with it.
, must be lined up (start in
X
equals 90, I/O pin 1 is
X > 50
” were checked
X

Related parts for 122-32000