3 ms·
for-in is elegant, and you can use enumerate() to access index. However, if we had to do reverse for-loops in Swift 3, we would have to use for-in with either f
by jathu 10y ago
for-in is elegant, and you can use enumerate() to access index. However, if we had to do reverse for-loops in Swift 3, we would have to use for-in with either from.stride(to:by:) or reverse(), and to me that is not as elegant as c style for loops.
- masklinn 10y agoInteresting, it feels significantly more elegant to me as you're simply telling the language what you want (reverse iteration) and it handles the exact details, and works for any reversible iterable.