Skip to main content
Version: 1.5.0

Adding

Adding an element to a set is done by calling the function Set.add. If the element was already present in the given set, the resulting set is the same as the original one.

const my_set: set<int> = Set.literal(list([3, 2, 2, 1]));
const with_4: set<int> = Set.add(4, my_set);

Note: See the predefined namespace Set