I use for loops all the time. Whether it's numerical or generic, they are very useful loops. But then, the other day, I was thinking. Why are they called 'for? It doesn't make a lot of sense when I think about it in English. Does anyone know why they named this very useful loop a 'for' loop?
Examples of a for loop:
for i = 1,10 do print(i) end
for i,v in pairs(Workspace:GetChildren()) do if v:IsA("BasePart") then v:Destroy() end end
for
loops names come from "for each", or because it is re-executed "for" each particular value the loop takes on.
Its usage in programming descends from ALGOL (and originally the German keyword für) according to Wikipedia. ALGOL is an old programming language (1950s) that is not used much in modern times, but was very influential on most future programming languages.
For example,
for i = 1, 10 do
could be read as "Do [the following] for each number 1 to 10."
for _, child in pairs(workspace:GetChildren())
"Do the following for each child"
There are 2 reasons I could think of For sounds like number 4. It can be used to indicate the number of success out of a specific number of attempts. It could also be used for objectives purposes so running a command a set number of times could also count as a reason.