for loop is a handy construct with some really useful shortcuts for making counting with a loop much easier. Specifically the syntax of a for loop allows you to easily:
When using a timed loop in place of a for loop you will need to take care of those three tasks on your own.
Here is a comparison of the how you might replicate the behavior of a for loop with a timed loop. Both of these examples will repeat four times, print out the following into the console:
loop #0 loop #1 loop #2 loop #3
falsethe loop will stop repeating. A key difference here is that the for loop checks its exit condition before each repeat of the loop, which the timed loop checks the condition during each repeat.
The example offered above is the closest match to how a for loop works, but you have the freedom to structure your timed loop however you like. Each of the following three examples will run the same four repetitions as the previous, but each one uses a different exit condition.
Found a bug in the documentation? Let us know at firstname.lastname@example.org