Skip to content

Repeats a string a specified number of times.

repeat(x:string, n:int) -> string

The repeat function returns a new string consisting of x repeated n times. If n is 0, the function returns an empty string.

The string to repeat.

The number of times to repeat x. Must be non-negative.

from {message: "na".repeat(8)}
{message: "nananananananana"}
from {message: "na".repeat(0)}
{message: ""}

Last updated: