repeat
The repeat: command iterates an array and repeats a sequence of commands for each value.
start:
set:
sum: 0
repeat:
each@json: [1,2,3,4,5,6,7,8,9,10]
as: i
do:
set:
sum@int: {{sum + i}}
return:
counter@key: counter
counter: 55
Syntax
each:
The each:
key must resolve to an array.
This is most often accomplished with one of the following annotations:
@csv |
Comma-separated values |
@json |
JSON-encoded values |
@list |
Newline-delimited values |
as:
The as:
key names the placeholder that holds the value of the current iteration of each:
.
This may optionally take the format of key, value
to set a placeholder for both the key and value of each:
item.
do:
The do:
key contains any number of commands to repeat.