I'm working with rails, it happens that when I run my project, I get to the point where I only have to have duplicate values inside the arrays, therefore I have to eliminate the NOT repeated values, for example:
array=[2017,2017,2018,2018,2019]
in this case the value 2019 should be eliminated, since it is not repeated
What I have is the following:
def saca_no_repetido(array)
for i in 0...array.length
if(array[i]!=array[i+1] && array[i+1]!=nil)
array.delete_at(i)
end
end
return array
end