Page 154 - The Ultimate Palm Robot
P. 154
Color profile: Generic CMYK printer profile
Composite Default screen
Bots /The Ultimate Palm Robot/ Mukhar & Johnson / 222880-6 / Chapter 6
Chapter 6 The Palm Robot Programmer (PRP) 137
The For Component A For component allows you to perform a loop some
set number of times. The For block contains a counter that is set by properties.
The properties are the start value, the number of loops, and the step size. The
step size is optional; if you don’t specify one, it is assumed to be 1. When you
add a For block to the program, the PRP automatically adds an EndFor block.
You can add components to the program between the For and EndFor blocks.
When the program encounters the For block, the counter is set to the start
value. Then the program components between For and EndFor are executed.
When the EndFor is reached, the counter is increased by the step size. If the
number of loops has been reached, the program jumps to the next block after
EndFor; otherwise, it goes back to the start of the loop and executes the blocks
again.
NOTE: Currently, the PRP supports only counting up. For example, if you
set the start value to 1 and the number of loops to 10, the counter will count
from 1 to 10 and then stop. However, if you try to set the start value to 10 and
the step size to –1 in an attempt to count 10, 9, 8, …, the program will not work.
The Continue Component If you are inside a While or For component,
Continue will stop executing the loop immediately and jump back to the
beginning of the For or While component. This component has no properties.
P:\010Comp\Bots\880-6\ch06.vp
Monday, May 12, 2003 1:06:24 PM