How to delete reoccurring values from a list?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Fenisto

I have a list of values. Let say: [1, 2, 2, 5, 5, 5, 7]
And I need to delete from it all reoccurring values. So that the result should be [1, 2, 5, 7]
How do I do that?

:bust_in_silhouette: Reply From: Eric Ellingson
func array_unique(array: Array) -> Array:
    var unique: Array = []

    for item in array:
        if not unique.has(item):
            unique.append(item)

    return unique
1 Like

Came here for a Set but this works I guess

1 Like