Runtime verified Test scripts included

Repeats a block a specified number of times, exposing index, first, and last loop variables.

Syntax

{{#repeat count}}
  …
{{/repeat}}

Returns string.

Parameters

Name Type Required Description
count integer Yes How many times to render the block. Must be a non-negative integer.

Example

Tested in a Marketing Cloud Next email on 2026-11-22:

  • {{#repeat 3}}x{{/repeat}} renders xxx, as documented.
  • {{#repeat 3}}{{index}}{{/repeat}} renders 012, as documented.
  • {{#repeat 0}}x{{/repeat}} renders an empty string, as documented.
Show Next test script
<!-- Marketing Cloud Next test script for the repeat helper. Paste it into the HTML component of a
     Next email and open the preview. Each line prints the result Next gave when the call
     was rendered on its own (expect) next to the result of this run (got).
     Assembled from single-call test emails (dates on the page); it has not been
     run as one email. Calls that make Next fail are listed separately. -->
<p>c1 expect=[xxx] got=[{{#repeat 3}}x{{/repeat}}]</p>
<p>c2 expect=[012] got=[{{#repeat 3}}{{index}}{{/repeat}}]</p>
<p>c3 expect=[] got=[{{#repeat 0}}x{{/repeat}}]</p>

Marketing Cloud Next

Works as documented

Every tested call rendered the documented result. Tested 2026-11-22 by rendering in a Marketing Cloud Next email.

See also