Add the syntax "For infinite loop " (#21382)

* Add the syntax "For infinite loop "

* Shifted additions around to be less confusing
This commit is contained in:
Prashant Chand
2018-11-14 07:54:02 +05:30
committed by Christopher McCormack
parent 9a1d101451
commit 5a99e02a87

View File

@ -23,7 +23,7 @@ The initialization statement is executed only once. Then, the test expression is
The for loop is commonly used when the number of iterations is known.
## Example
#### Example
```c
#include <stdio.h>
@ -37,7 +37,7 @@ int main () {
}
```
## Output:
#### Output:
```shell
> Item on index 0 is 1
> Item on index 1 is 2
@ -88,3 +88,12 @@ main ()
## Syntax of For infinite loop
```c
for ( ; ; ) {
statement(s);
}
```
An infinite loop occurs when the condition will never be met, due to some inherent characteristic of the loop. An infinite loop also called an endless loop, and it is a piece of coding that lacks a functional exit so that it repeats indefinitely.