repeat

Summary

Repeats the array elements for the specified number of times.

Usage

public T[] repeat(unsigned int times)

Returns

A new array with the specified elements repeated.

Parameters

times

The number of repetitions to repeat the array value(s).

Description

Repeats the array elements for the specified number of times. A new array is allocated and returned.

This method does not mutate the original array.

Examples

Basic Usage
1
2
3
import System;
 
Console.log([1, 2, 3].repeat(1)); // [ 1, 2, 3, 1, 2, 3 ]

Share

HTML | BBCode | Direct Link