The Arduino programming language has three looping statements which are the for, while and do/while loops. We will start off by looking at the for loop.
The for loop is used to repeatedly execute a block of code. The for loop is usually used to execute a block of code a specific number of times or to access elements in an array. There are three parts to the for statement. These parts are the initialization, condition, and increment.
In the initialization portion of the for statement, we initialize any variables that need to be initialized. There can be multiple initializations separated by commas, but I would recommend avoiding any initialization here that is not directly related to the for loop.
The condition portion of the for statement, expect a statement that will return either a true or false and it usually contains a conditional statement. This portion of the loop...