What is an infinite loop?

what is an infinite loop, how it works?

2 Likes

hello Muxafor!!!
An infinite loop in any programming language is a loop which never ends i.e. till your condition is true, terminating condition has not been set,cannot occur and/or cause the loop to restart. goto is the best example of this as goto always keep restarting a particular block, but you can stop it whenever you want by holding CTRL+C(in python).
hope it helps.

1 Like

infinite loop is an endless loop…the loop goes on until the terminating condition is set…to create a infinite loop in python is to use a while statement…

When a block of statements is required to be executed several times a loop is used so that we don’t need to write them again and again.A loop is entered when a condition is satisfied.But there must a terminating condition for a loop otherwise it leads to the situation of infinite loop in which program never terminates as the condition is always satisfied.

Hi
In python if we write while(True) it runs infinitely because syntax of while is
syntax: while(condition):statements. Until the condition become true i.e., until it satisfies the condition the while loop runs.As we gave True inside the condition it satisfies infinitely. Until we replace it with some condition that becomes false it runs infinitely.
check for more information:https://intellipaat.com/blog/tutorial/python-tutorial/python-while-loops/
:slightly_smiling_face:

Infinite loop are loop which never ends. A loop becomes infinite loop if a condition never becomes FALSE. We can create an infinite loop using while statement. If the condition of while loop is always True , we get an infinite loop.
Even infinite loop also have many applications
Ex: digital clock in every electronic devices such as computer, mobile.
2) There are a few situations when this is desired behavior. For example, the games on cartridge-based game consoles typically have no exit condition in their main loop, as there is no operating system for the program to exit to; the loop runs until the console is powered off.

An infinite loop is a loop which loops endlessly, either due to no terminating condition, or no increment condition.
Check this link to wiki: https://en.wikipedia.org/wiki/Infinite_loop

any loop which never ends is known as infinite loop…if u run the code the output will be printing continue to infinity…it is never ending…

infinite loop is somewhat that continue till your condition become satisfy like suppose if you face any problem in understanding the concept of course then you read it again and again till you thoroughly understand the concept.
hope now you understand what is infinite loop.

infinite loop is never false condition

An infinite loop (or endless loop ) is a sequence of instructions that, as written, will continue endlessly, unless an external intervention occurs (“pull the plug”).
eg:-

int i = 1;
while(i<10){
printf(“%d\n”, i);
}

The above is an example of infinite loop as the value of i is not changing, so the loop will run until the memory runs out

:sunglasses:

    1. An infinite loop is an instruction sequence that loops endlessly when a terminating condition has not been set, cannot occur, and/or causes the loop to restart before it ends.
    1. An infinite loop is also known as an endless loop.

Infinite Loop in any programming language is a type of loop which never ends means it execute continuously.To end this type of loop we have to set condition in loop so by checking that condition in loop,the loop terminates.Infinite loop unnecessarily increase the time of our program,decrease the efficiency of our program,increase the space complexity for our program.
Infinite loop generally occurs when we forget to mention terminate condition inside the loop For example if in loop we check “i<3” and initially if “i” is 1 and if we don’t update variable “i” inside the loop then the infinite loop arrise . By adding updation condition (i+=1) for i variable inside the loop the loop breaks else it results in infinite loop.

Hey!
So basically infinite loop is a sequence of instructions that will continue endlessly unless an external intervention occurs.

infinite loop is sequence of instruction which will continue endless an external intervention occurs

@muxaforhussain @discobot
An infinite loop (sometimes called an endless loop ) is a piece of coding that lacks a functional exit so that it repeats indefinitely. … Usually, an infinite loop results from a programming error - for example , where the conditions for exit are incorrectly written.

An infinite loop is an instruction sequence that loops endlessly when a terminating condition has not been set, cannot occur, and/or causes the loop to restart before it ends.

An infinite loop is also known as an endless loop.

Infinite loop is a loop that remains in execution endlessly

An infinate loop is a loop which never gets terminated Unless you shut down your code or stop excecution of the code.

Hello @muxaforhussain. An infinite loop can be taken as an reoccurring task which repeats endlessly. In technical terms it is denoted as a loop that runs endlessly, until a certain condition is met.
Example:
do {
Block of statements;
}
while(1);