Depends. If you’re using a good ol’ C-style for loop then nothing’s wrong with for(int i = 0; i < something;i++), but if you’re doing something like iterating over some collection it’s way clearer to do something like foranimalin animals: than it is to do forein animals:.
Especially if you’re doing something non-trivial for each element
Depends. If you’re using a good ol’ C-style for loop then nothing’s wrong with
for(int i = 0; i < something;i++), but if you’re doing something like iterating over some collection it’s way clearer to do something likefor animal in animals:than it is to dofor e in animals:. Especially if you’re doing something non-trivial for each element