Per-iteration state passed to the callback function on each pass of a foreach loop in templates and GraalJS scripts, exposing the current zero-based index and letting the callback stop the loop early.


Properties

PropertyReturnsDescription
indexintZero-based position of the current item within the foreach loop, incremented after each item finishes processing.

Methods

getIndex()

Returns: int

Zero-based position of the current item within the foreach loop, incremented after each item finishes processing.

breakForeach()

Returns: void

Requests that the innermost foreach loop calling back into this context stop once the current item has finished processing, equivalent to a break statement inside the loop body.

To get full access to the Kademi Hub existing customers can login here, or new customers can register here.