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

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
We changed the loop from
loop, three lines below
“conditional one-to-many loop.” It executes the statement block within it at least once, and
iterates again and again as long as the “while” condition is true. In this case it repeats while
Count := --Count #> -1
expression. The double-minus, ‘
decrements
Minimum operator; it takes the value on its left and returns either that value, or the number
on its right, whichever is greater. So each time this expression is evaluated,
decremented by 1, that result is limited to -1 or higher, and that final result is assigned back
into
If
After the first iteration, the
it 1, then would limit it to -1 or higher (still 1) and store that value in
1, is non-zero (
statement would decrement
store that in
That works for all normal
of 0? After the first iteration, the
making it -1, then would limit it to -1 or higher (still -1) and store that value in
the result, -1, is non-zero (
WHILE
-1) and stores that in
would execute again.
So, if
it loops only that number of times!
Page 122 · Propeller Manual v1.0
Toggle
Count
Count
statement decrements
. This has a clever effect that we’ll explain next.
was called with
Count
Count
started out as 0, the loop iterates endlessly! If
TRUE
. Since 0 is
by 1 before its value is used by the expression. The
) the loop would execute again. After the second iteration, the
Count
repeat
Count
TRUE
Count
is
while Count := --Count #> -1
repeat Count
Count
. Once again, since the result, -1, is non-zero (
Count
FALSE
TRUE
) the loop would execute again. After the second iteration, the
. This is another form of
set to 2, the loop would execute two times, just like we want.
values, but what about when
, making it 0, would limit that to -1 or higher (still 0) and
, making it -2, limits that to -1 or higher (it is changed to
while Count := --Count #> -1
--
, the
(ie: non-zero).
‘ ‘preceding
WHILE
to
repeat..while
condition terminates the loop.
Count
This condition is another compound
is the Pre-Decrement operator; it
Count
. The
would decrement
REPEAT
Toggle
started out as greater than 0,
while
would decrement
loop structure called a
Count
is called with a
is at the end of the
. Since the result,
#>
TRUE
Count
Count
is the Limit
) the loop
, making
Count
. Since
Count
WHILE
Count
is
,

Related parts for 122-32000