528 Programming
In Home, enter
MAXFACTORS(100) .
FOR STEP Syntax: FOR var FROM start TO finish [STEP increment]
DO commands END;
Sets variable var to start, and for as long as this variable
is less than or equal to finish, executes the sequence of
commands, and then adds increment to var.
Example 2: This
program draws an
interesting pattern on
the screen.
EXPORT
DRAWPATTERN()
BEGIN
LOCAL
xincr,yincr,color;
STARTAPP("Function");
RECT();
xincr := (Xmax - Xmin)/320;
yincr := (Ymax - Ymin)/240;
FOR X FROM Xmin TO Xmax STEP xincr DO
FOR Y FROM Ymin TO Ymax STEP yincr DO
color := FLOOR(X^2+Y^2) MOD 32768;
PIXON(X,Y,color);
END;
END;
FREEZE;
END;
FOR DOWN Syntax: FOR var FROM start DOWNTO finish DO commands
END;
Sets variable var to start, and for as long as this variable
is more than or equal to finish, executes the sequence of
commands, and then subtracts 1 (decrement) from var.