Zum Hauptinhalt springen

Array range

Anatomy

<array:range var="var" from="int" to="int" step="1"/>

Description: ARRAY:RANGE creates an array with values of a given numeric range.

ARRAY:RANGE will implicitly generate a consecutive numeric key for each item of the numeric range.

Attention:

If the given step is less than one, the array will be empty.

Attributes

NameTypeDescriptionDefined By
varvarResult variable name array:range
fromintFrom array:range
tointTo array:range
stepintStep array:range

Results:

BindingTypePredicate
vararrayno-result-propagation

Examples

Incremental range

<array:range var="range" from="6" to="10" step="2"/>

<output>
<array:join var="range" delimiter=", "/>
</output>

<!-- 6, 8, 10 -->

Decremental range

<array:range var="range" from="10" to="6" step="2"/>

<output>
<array:join var="range" delimiter=", "/>
</output>

<!-- 10, 8, 6 -->