Site under construction! :3
extend(*arrays: array, allow_duplicates: bool = true) -> none
ξ―
Definitionξ―
(method) func array.extend(*arrays, allow_duplicates: bool = true) -> none: for arr in arrays: self.push(item) for item in arr if allow_duplicates or item not in arr
Modifies the original array
to contain each value of the input arrays.
Parametersξ―
*arrays
ξ―
A series of array
objects.
Pigeonξ―
> arr1 = [1, 2, 3] > arr2 = [3, 4, 5] > arr1.combine(arr2) > print(arr1) [1, 2, 3, 3, 4, 5]
allow_duplicates
ξ―
1.0.0 Boolean Optional (/projects/pigeon/docs/types/boolean/true)]
Controls whether items in arrays
that are already in the instance array are included.
Pigeonξ―
> arr1 = [1, 2, 3] > arr2 = [3, 4, 5] > arr1.combine(arr2, allow_duplicates = false) > print(arr1) [1, 2, 3, 4, 5]
This does not affect duplicate items within the instance array themselves.
Pigeonξ―
> arr1 = [1, 2, 3, 3, 3] > arr2 = [3, 4, 5] > arr1.combine(arr2, allow_duplicates = false) > print(arr1) [1, 2, 3, 3, 3, 4, 5]