Handlebar Helper Function: Repeat

Repeats a block of template code a specified number of times, providing loop context variables for each iteration.

Availability 

This helper is available in the Winter ’26 release of Marketing Cloud Next (API version 65.0).

Syntax 

1{{#repeat count}}
2  Block content
3{{/repeat}}

Parameters 

ParameterTypeDescription
countInteger or StringRequired. Number of times to repeat. Must be convertible to a non-negative integer (>= 0).

Return Value 

The function repeats the block count times and returns the concatenated result.

Each iteration provides these loop variables:

  • index: A 0-based index of the current iteration.
  • first: A boolean indicating whether the current iteration is the first iteration.
  • last: A boolean indicating whether the current iteration is the last iteration.
  • All parent context variables.

If count is 0, the function returns an empty string. If the parameter is invalid, the function throws an exception.