Login
Products
Development Software
Open Source Software
Pyxis Boards
For/Next
The for statement is used to repeat a block of statements between the For and Next statements. An increment counter is usually used to increment and terminate the loop. The for statement is useful for any repetitive operation, and is often used in combination with arrays to operate on collections of data/pins.
There are three parts to the for loop header: initialization, condition & increment
The initialization happens first and exactly once. Each time through the loop, the condition is tested; if it's true, the statement block, and the increment is executed, then the condition is tested again. When the condition becomes false, the loop ends.