WLJS LogoWLJS Notebook

Union

Union[list1, list2, ...] gives a sorted list of all distinct elements from any of the lists.

Union[list] gives a sorted version of a list with duplicates removed.

Examples

Union of lists:

Union[{a, b, c}, {b, c, d}]
(* {a, b, c, d} *)

Remove duplicates and sort:

Union[{3, 1, 2, 1, 3}]
(* {1, 2, 3} *)

Please visit the official Wolfram Language Reference for more details.

On this page