Infinite loop, fixed iteration (#29697)
This commit is contained in:
committed by
The Coding Aviator
parent
44264b2b3a
commit
1282227c24
@ -3,7 +3,10 @@ title: While Loop
|
|||||||
---
|
---
|
||||||
# While Loop
|
# While Loop
|
||||||
|
|
||||||
The `while` loop repeatedly executes the block of statements until the condition specified within the parentheses evaluates to `false`. For instance:
|
The `while` loop repeatedly executes the block of statements until the condition specified within the parentheses evaluates to `false`.
|
||||||
|
It is usually used when the number of iterations is not fixed.
|
||||||
|
|
||||||
|
For instance:
|
||||||
|
|
||||||
```java
|
```java
|
||||||
while (some_condition_is_true)
|
while (some_condition_is_true)
|
||||||
@ -37,4 +40,6 @@ Output:
|
|||||||
iter_While Value: 10
|
iter_While Value: 10
|
||||||
```
|
```
|
||||||
|
|
||||||
|
An infinite while loop is created when the loop remains true infinitely , maybe because there is no change in the change in value of the condition or it never turns false.
|
||||||
|
|
||||||
 [Run Code](https://repl.it/CJYj/0)
|
 [Run Code](https://repl.it/CJYj/0)
|
||||||
|
Reference in New Issue
Block a user