This is an old revision of the document!
For is a cycle operator that allows to specify the number of times when the same statements will be executed. In this way, similar to the loop function it allows to control the program execution. Each time when all statements in the body of the cycle are executed, is called the iteration. In this way, the cycle is one of the basic programming techniques that is used for all programs and automation in general.
The construction of a for cycle is the following:
for (initialization ; condition ; operation with the cycle variable) { //The body of the cycle }
Three parts of the for construction is following:
The example of the for cycle:
for (int i = 0; i < 4; i = i + 1) { digitalWrite(13, HIGH); delay(1000); digitalWrite(13, LOW); delay(1000); }