FUNCTION

list.repeat

function repeat(n: integer): list<T>

Repeat this list n times.

Examples:

  • [1, 2, 3].repeat(3) returns [1, 2, 3, 1, 2, 3, 1, 2, 3]
  • list<T>().repeat(3) returns [] (for any type T)
  • [3].repeat(0) returns []

Parameters

  • n — the number of times to repeat this list

Returns

a new list with the elements from this list repeated n times

Throws

  • exception — when: - n is negative - n is greater than (2^31)-1 - the resulting list has size greater than (2^31)-1

Since

0.11.0

© 2026 Chromia