for
loopfor
loops offer a quick and easy way to do something repeatedly. They're handy, if you want to run the same code over and over again, each time with a different value. You can think of a loop as a computerized version of the game where you tell someone to take X steps in one direction then Y steps in another; for example, the idea "Go five steps to the east" could be expressed this way as a loop:for
looping construct and the loop can be written in different ways:in
operator for array/mapNote: The value is read-only.
for
loop with a conditionfor
loop can also be infinite