List.duplicate

You're seeing just the function duplicate, go back to List module for more information.

Specs

duplicate(any(), 0) :: []
duplicate(elem, pos_integer()) :: [elem, ...] when elem: var

Duplicates the given element n times in a list.

n is an integer greater than or equal to 0.

If n is 0, an empty list is returned.

Examples

iex> List.duplicate("hello", 0)
[]

iex> List.duplicate("hi", 1)
["hi"]

iex> List.duplicate("bye", 2)
["bye", "bye"]

iex> List.duplicate([1, 2], 3)
[[1, 2], [1, 2], [1, 2]]