<repeat>
<repeat>
is a General Operator
component that performs the requested operations in an iterative manner over the component specified (typically,
this is a list or an array). If the specified component is a <sequence>
, a shorter method is to
use the <repeatForSequence>
component.
The behavior of the <repeat>
component is similar to a for loop in other programming languages.
Attributes and Properties
Attribute | Type | Values |
---|---|---|
asList = "…" | "true" "false" | |
for = "…" | ||
indexName = "…" | ||
type = "…" | ||
valueName = "…" |
<repeat>
does not have any properties.
Example: <repeat>
a series of rectangles within a <graph>
A <repeat>
can be used to generate multiple graphical elements at once when placed within a <graph>
.
Example: <repeat>
a user-specified number of inputs
A <repeat>
can be used to generate a user-specified number of <mathInput>
components.
For an alternative way to do this, see the <repeatForSequence>
component.
Example: <repeat>
a list of <text>
elements
A <repeat>
can be used with non-mathematical components as well. Individual
entries can be accessed using array notation.
Example: Use <repeat>
in a combinatoric way
Use nested <repeat>
components to iterate across all combinations of the specified components.
Example: Use <repeat>
in a selective way
To achieve parallel iterative behavior, a combination of the indexName
and valueName
attributes can be used.
Example: Generate a user-specified number of random <point>
components
A <repeat>
can be used to generate a user-specified number of randomly placed <point>
components.
For an alternative way to do this, see the <repeatForSequence>
component.