Repeated Text

<< Click to Display Table of Contents >>

Navigation:  Problem Descriptor Reference > The Elements of a Descriptor >

Repeated Text

Previous pageReturn to chapter overviewNext page

The REPEAT..ENDREPEAT construct allows the repetition of sections of input text.

The syntax looks like a FOR loop in procedural languages, but we emphasize that in FlexPDE this feature constitutes a textual repetition, not a procedural repetition.

The form of a repeat clause is

REPEAT name = initial TO final

REPEAT name = initial BY delta TO final

These statements specify that the following lines of descriptor text should be repeated a number of times.  The given name is defined as if it had appeared in the DEFINITIONS section, and is given the value specified by initial.

The repeated section of text is terminated by the statement



At this point, the value of name is incremented by delta (or by one, if no delta is given).  If the new value is not greater than final, the repeated text is scanned again with the new value in place of name.  If delta is negative, the value of name is decremented and the termination test is modified accordingly.

The REPEAT statement can appear in the following locations:

in BATCH file lists
in VARIABLE lists
in EXTRUSION lists
anywhere the REGION, START or LINE keywords are legal.
around any plot command or group of plot commands.
around any DEFINITION or group of DEFINITIONS.
around any REPORT command or group of REPORT commands.
around AT points in a HISTORY list


Use of ARRAYS and the $integer string function can extend the power of the REPEAT loop.


REPEAT xc=1/4 by 1/4 to 7/4

REPEAT yc=1/4 by 1/4 to 7/4

START(xc+rad,yc) ARC(CENTER=xc,yc) ANGLE=360 CLOSE




This double loop constructs a 7 x 7 array of circles, all part of the same REGION.


See the sample problems:

Samples | Usage | Repeat.pde


Note: REPEAT..ENDREPEAT replaces the older FOR..ENDFOR facility used in earlier versions of FlexPDE.  The older facility is no longer supported, and will produce parsing errors.