Computer Science, asked by Saxenaavinash428, 5 months ago

if the condition of while loop is always true , you get an infinite loop​

Answers

Answered by lakshaya98
0

Answer:

We can generate an infinite loop intentionally using while True . In this case, the loop will run indefinitely until the process is stopped by external intervention ( CTRL + C ) or when a break statement is found (you will learn more about break in just a moment).

Explanation:

PLS LIKE AND FOLLOW

Answered by Anonymous
1

Infinite Loops

A common infinite loop occurs when the condition of the while statement is set to true . Below is an example of code that will run forever. It is not necessary to test any infinite loops. An infinite loop will run forever, but the program can be terminated with the break keyword.

If the condition is true ( non-zero ), then the body of the loop is executed next. If the condition is false ( zero ), then the body is not executed, and execution continues with the code following the loop.The while loop will continue as long as the condition is non zero. is also an infinite loop ( because 2 is non zero, and hence true ) . 0 is equal to false, and thus, the loop is not executed.

Hope it helps you....

Plz follow me

Similar questions