With very little effort we can make a variety of designs out of our unit “halfcirc”. For example:
The effect of the -do- statement is to set y to 100 and do unit “halfcirc”, then set y to 170 (the starting value of 100 plus an increment of 70) and do halfcirc again, and repeat the process until y reaches the final value of 380. The format of the extremely useful iterative -dostatement is:
In the above example, the index “y” starts at 100 and goes to 380 in increments of 70. If no increment is specified, an increment of one is assumed. For example, “do halfcirc, radius⇦101,105” will make an arc five dots wide, as in the following figure:
The iterative -do- statement also helps in making animations. The following statements will cause the half-circle to move horizontally across the screen. (See Figures 4-5a and 4-5b.)
We simply -do- unit “anim” repeatedly for different values of x (the horizontal position of the figure on the screen). Unit “anim” does unit “halfcirc” twice, once to draw and once to erase the figure interrupted by a one-second pause. The -catchup- command insures that a second will elapse from the end of drawing the figure on the screen until the beginning of erasing it.
Now that you have studied -define-, -talc-, and -do-, you have learned the basic techniques of how to tell PLATO what calculations you want performed. We have applied these tools to a variety of display generation problems, and we will later use calculations for controlling sequencing in a lesson and for judging responses. Hopefully, you have gained added insight into the value of a subroutine. Notice how many different ways we have used the single unit “halfcirc”!