3 ms·
If readability matters, there shouldn't be an extra counter variable for the reader to keep in mind. for greeting in greetings do is more readable if noth
by tom_mellior 6y ago
If readability matters, there shouldn't be an extra counter variable for the reader to keep in mind.
for greeting in greetings do
is more readable if nothing interesting is done with the counter itself.
- Jtsummers 6y agoAda does this. Offering both styles: for x of Some_Array loop for i in Some_Array’Range loop Allowing you to do the appropriate thing for your situation.
- pjmlp 6y agoIndeed, I just wrote the version where the counter matters, because it was used as such on the original examples. As a matter of fact, Object Pascal/Delphi uses the for in syntax when it doesn't matter.