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

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
This loop started out with
decrements
= 6 and
Iteration 5 has
3) is outside the range of Start to Finish (5 to 10).
Conditional Loops (Syntax 3 and 4)
The final forms of
flexible options allowing for the use of either positive or negative logic and the creation of
zero-to-many or one-to-many iteration loops. These two forms of
to as “repeat while” or “repeat until” loops.
Let’s look at the
followed immediately by either
below it, optional Statement(s). Since this form tests Condition(s) at the start of every
iteration, it creates a zero-to-many loop; the Statement(s) block will execute zero or more
times, depending on the Condition(s). For example, assume that
earlier:
This example first sets
the loop clears RAM locations based on
After the 10th iteration of the loop,
the loop terminates.
This loop is said to use “positive” logic because it continues “
could also be written with “negative” logic using
D := 2
repeat Index from 5 to 10 step D
X := 0
repeat while X < 10
X := 0
repeat until X > 9
--D
byte[$7000][X] := 0
X++
byte[$7000][X] := 0
X++
D
= 0. Iteration 3 has
D
by one, so at the end of iteration 1,
Index
REPEAT
REPEAT
= 3 and
X
to 0, then repeats the loop while
form described by syntax 3. It consists of the
, syntax 3 and 4, are finite loops with conditional exits and have
Index
D
= -3. The loop then terminates because
Index
WHILE
at 5 and a Delta (
X
equals 10, making the condition while
= 6 and
'Repeat while X is less than 10
'Increment RAM value
'Increment X
'Repeat until X is greater than 9
'Increment RAM value
'Increment X
or
4: Spin Language Reference –
UNTIL
X
(starting at location $7000) and increments
D
= -1. Iteration 4 has
UNTIL
Index
then Condition(s) and finally, on the lines
D
) of +2. But each iteration of the loop
, instead. Such as:
= 5 and
X
is less than 10. The code inside
Propeller Manual v1.0 · Page 297
WHILE
D
= +1. Iteration 2 has
REPEAT
” a condition is true. It
X
Index
Index
is a variable created
are usually referred
REPEAT
plus Delta (3 + -
X
= 5 and
< 10 false and
command
D
Index
= -2.
X
.

Related parts for 122-32000