In swift, I want to compare two different indexes in the same array. Right now, My code is something like:
var myArray:[String] = ["1" , "1", "2"]
for i in myArray{
if(myArray[i] == myArray[i + 1]){
// do something
}
}
From this, I get an error:
Cannot convert value of type 'String' to expected argument type 'Int'
How do I go about fixing this?