repeat

The repeat function repeats the first arguments a given number of times.


repeat( item, times )

Returns a new collection that contains the given item repeated ‘times’ number of times.

Arguments

    1. item – the item to repeat
    2. times – the number of times to repeat the item

Example

repeat “hello” 5 times, and then print out the resulting collection.

Would print out “hello”, “hello”, “hello”, “hello”, “hello”.


repeat( collection, times )

repeats all the items in the collection the given number of times.

Arguments

        1. collection – the collection to repeat
        2. times – the number of times to repeat the entire collection

Returns

A new collection that contains all of the items in the given collection repeated ‘times’ number of times.

Example

repeat a collection of words and then print out the repeated collection.

Would print out “Apple”, “Banana”, “Carrot”, “Apple”, “Banana”, “Carrot”, “Apple”, “Banana”, “Carrot”.