Union
Syntax
union($set1,$set2, ..., $setN)
Description
Calculates the union of the sets set1,... setN
.
Parameters
Name | Type | Description | Mandatory | Default |
---|---|---|---|---|
set | Set | Sets that are to be combined into a single set. | yes |
Return value
Type: Set
A set containing all elements of the sets set1,... setN
. No duplicates will be added, even if multiple sets contain the same elements.
Examples
Simple union
union(list(1, 2, 3), list(4, 5, 6), list(7, 8, 9))
Output: A set with the elements [1, 2, 3, 4, 5, 6, 7, 8, 9].
Union of duplicates
union(list(1, 2, 3), list(1, 2, 3, 4, 5))
Output: A set with the elements [1, 2, 3, 4, 5].
The numbers 1 and 2 are added only once, because a set must not contain duplicates.