May 15, 2021 Arduino
Programming languages provide a variety of control structures that allow for more complex execution paths.
Loop statements allow us to execute a statement or set of statements multiple times, as is the general form of circular statements in most programming languages:
The C language provides the following types of loops to handle loop requirements.
Serial number | Loops and descriptions |
---|---|
1 |
The while loop will be continuous and infinite until the expression in parentheses () becomes false. /b10> Something must be used to change the variable being tested, otherwise the while loop will never exit. |
2 |
do ... T he while loop is similar to the while loop. /b10> In a while loop, the loop continuity condition is tested at the beginning of the loop, and then the loop body is executed. |
3 |
For loop The number of times the statement was executed. /b10> The control expression of the loop is fully initialized, tested, and operated in for loop parentheses. |
4 |
The C language allows you to use a loop within another loop. /b10> The following example illustrates this concept. |
5 |
It is a loop with no termination criteria, so the loop becomes infinite. |