Answers for "how to iterate backwards in swift for loop"

0

loop backwards swift

for index in stride(from: 10, to: 5, by: -1) {
    print(index)
}
//10, 9, 8, 7, 6, 5

for index in stride(from: 10, through: 5, by: -1) {
    print(index)
}

//10, 9, 8, 7, 6, 5
Posted by: Guest on July-22-2020

Code answers related to "how to iterate backwards in swift for loop"

Code answers related to "Swift"

Browse Popular Code Answers by Language