bmel:forRange¶
Category: Logic & Control Flow · Returns: bmel:array
bmel:forRange(from: bmel:integer, to: bmel:integer, body: bmel:expression)
Description¶
Iterates from bmel:from to bmel:to (both inclusive, step +1) and evaluates bmel:body at each step, collecting results into an array. Within bmel:body the current loop index is accessible as bmel:i. Returns an empty array when bmel:from > bmel:to.
Arguments¶
| Parameter | Type | Required | Description |
|---|---|---|---|
from | bmel:integer | ✅ | Start index (inclusive). |
to | bmel:integer | ✅ | End index (inclusive). |
body | bmel:expression | ✅ | Expression evaluated at each iteration step. The current index is accessible as bmel:i. |
Example¶
bmel:forRange(1, bmel:count({order:Response Payload}.$.items), bmel:i)