# Unique and Distinct Values Using Arrays

Learn to create a program that searches for unique and distinct elements within an array.

## We'll cover the following

In this lesson, we’ll learn about two special numbers

the terms “unique” and “distinct” are used to describe the elements of a set or collection.

A “unique” element is an element that appears only once in a set or collection. If an element appears more than once in a set, it is not considered to be unique.

A “distinct” element is an element that is different from all other elements in a set or collection. It doesn’t matter how many times an element appears in the set, as long as it is different from all other elements, it is considered to be distinct.

In other words, all unique elements are distinct, but not all distinct elements are unique.

For example, consider the set [1, 2, 3, 4]. Elements 1, 2, 3, and 4 are all unique and distinct elements of the set. If we add element 4 again, the set becomes [1, 2, 3, 4, 4]. In this set, the elements 1, 2, 3, and 4 are still distinct, but 4 is no longer unique because it appears twice in the set.

Get hands-on with 1200+ tech skills courses.