Andreza’s answer is correct, but if you need to know the position of an element within a loop you need to use the method enumerated
in your array.
var nomes = ["Douglas", "Marilia", "Roberto", "Carol", "Lucas", "Iasmim", "João", "Zeca"]
nomes.append("Franklyn")
print(nomes)
for (index, constante) in nomes.enumerated() {
print("Constante \(constante) at posição \(index)")
}
Douglas constant at position 0
Marilia constant at position 1
Roberto constant at position 2
Carol constant at position 3
Constant Luke at position 4
Constant Iasmim at position 5
Constant John at position 6
Zeca constant at position 7
Franklyn constant at position 8