You can simply use the end attribute for that. From the documentation:
If value specified: Iteration ends at the item located at the specified index (inclusive). If value not specified: Iteration ends when index reaches the specified value (inclusive).
Note that there also is a begin attribute. Documentation:
If value specified: Iteration begins at the item located at the specified index. First item of the collection has index 0. If value not specified: Iteration begins with index set at the specified value.
You can simply use the
endattribute for that. From the documentation:Note that there also is a
beginattribute. Documentation:So you can simply do: