UniCoreFW

unshift()

Adds elements to the beginning of an array.

Implementation

Args: array: The array to modify *values: The values to add to the beginning of the array Returns: The modified array

Example

unshift([2, 3], 1)

Expected output: [1, 2, 3]

Alternative usage:

Expected output:

Source Code

def unshift(array: List[T], *values: T) -> List[T]: for v in reversed(values): array.insert(0, v) return array