What do "n" and "i" mean in swift?

Viewed 57

I'm teaching myself Swift and am sometimes able to grasp larger concepts while being unclear on details or why they work.

I figured out how to take an array and use a for loop to cycle through every third element and print them in reverse order.

Is "n" is the element's placement in the array? What exactly is "i"?

let numberArray = ["One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten"]


func everyOther() {
    for (n, i) in numberArray.enumerated().reversed() {
         
        if (n+1).isMultiple(of: 3) {
            print(i)
        } //if
    }// for
}// func

everyOther()

Thank you

1 Answers
Related