If you have a fixed binding and step and do not allow modification of the loop variable in the loop body, then for loops there correspond primitive recursive functions.
From a theoretical point of view, they are weaker than general ones, while loops, for example, you cannot calculate the Ackerman function with only such cycles.
If you can provide an upper bound for a condition in a while loop to become true, you can convert it to a for loop. This shows that in a practical sense there is no difference, since you can easily provide an astronomically high boundary, for example, longer than the life of the Universe.
starblue
source share