How to iterate loop and return the original data from duplicated [duplicate]

How to iterate loop and return the original data from duplicated

I need to use only for loop.

Array >
0: 2019
1: 2019
2: 2020
3: 2019
4: 2016
5: 2016
6: 2016
7: 2019
8: 2019
9: 2019
10: 2019


I need only [2019,2016,2020];

I don’t want the duplicated values.

I hope you guys can help

Source: New feed
Source Url How to iterate loop and return the original data from duplicated [duplicate]