<repeatForSequence>
<repeatForSequence> is a General Operator
component that performs the requested operations in an iterative manner over the sequence specified.
Its behavior is similar to a for loop in other programming languages.
Attributes and Properties
Attributes for <repeatForSequence>
Other (9)
asListboolean. Default value: true. Whether to render the items separated by commas (true) or with no separator (false).
exclude_componentListWithSelectableType. Values to exclude from the sequence.
from_componentWithSelectableType. The first value in the sequence.
indexNametext. Name to bind the current 1-based index to inside the repeat template.
lengthinteger. The number of values in the sequence.
stepmath. The increment between successive values in the sequence.
to_componentWithSelectableType. The last value in the sequence. Used together with from to determine length when length is not specified.
typekeyword. The kind of values in the sequence.
| Value | Description |
|---|---|
number | A sequence of numeric values. |
math | A sequence of math expressions (allows symbolic from/to/step). |
letters | A sequence of letters (single-letter or multi-letter labels). |
valueNametext. Name to bind the current item to inside the repeat template.
Common to all components (9)
copyreference. Create an independent copy of another component by reference. Enter a references a $name.
disabledboolean. Default value: false. Whether this component is disabled and cannot be interacted with.
extendreference. Extend another component by reference, inheriting its children and attributes. Enter a reference as $name.
fixedboolean. Default value: false. Whether this component's value is fixed and cannot be modified.
fixLocationboolean. Default value: false. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
hideboolean. Default value: false. Whether to hide this component from the rendered output.
isResponseWhether the generated repeats should be treated as responses for assessment.
nametext. The name used to reference this component from elsewhere in the document.
styleNumberinteger. Default value: 1. The style number used to select this component's visual styling from the available style definitions.
Properties for <repeatForSequence name="r">
Common to all components (3)
$r.doenetMLtext. The DoenetML source code that produced this component.
$r.hideboolean. Whether to hide this component from the rendered output.
$r.styleNumberinteger. The style number used to select this component's visual styling from the available style definitions.
Examples
Example: <repeatForSequence> a set of points within a <graph>
A <repeatForSequence> can be used to generate multiple graphical elements at
once when placed within a <graph>.
Example: <repeatForSequence> a user-specified number of inputs
A <repeatForSequence> can be used to generate a user-specified number of <mathInput>
components.
The <repeatForSequence> component generates an array. Individual entries can be accessed
using array notation.
Example: Nested <repeatForSequence> to generate an irregular grid
A <repeatForSequence> can be nested within another <repeatForSequence> to iterate
over a combination of sequences with different ranges and steps.
Example: Generate a user-specified number of random <point> components
A <repeatForSequence> can be used to generate a user-specified number of randomly placed <point> components.