by SilasX · 6y ago · 0 comments
I don't know about a loop per se, but it's used in plain language when you want the same thing to be done to every element in a set. "Clean this item and put it away. Then do that for every other piece of cooking equipment."
It was actually originally borrowed from its cognate für in German:
>>The name for-loop comes from the English word for, which is used as the keyword in many programming languages to introduce a for-loop. The term in English dates to ALGOL 58 and was popularized in the influential later ALGOL 60; it is the direct translation of the earlier German für, used in Superplan (1949–1951) by Heinz Rutishauser, who also was involved in defining ALGOL 58 and ALGOL 60.
Without the "do" it's nonsensical. And that was exactly my point.
I'd certainly agree that "for each" is much better than "for" alone.
I'd certainly agree that "for each" is much better than "for" alone.
It should not be a shock that the english language doesn't naturally have a single word that can express both a condition/duration as well as a command without any other helper words.
Do is superfluous. Everything in an imperative program is a request to do something.