That kind of loop is referred to as an Infinite Loop. It occurs when the exit conditions can never be met or when the programmer fails to supply an exit.
For example:
Do while (1>0)
(that will loop forever because 1 is always greater than 0)
Yes! Such a loop might look like these examples, which all do the same thing (effectively), in different languages:
BASIC:
10 HOME
20 GOTO 10
PHP:
for (x=0; x>1; x++) { x--; }
The PHP example could be easily ported into most languages with very little effort. Essentially, it creates a loop for which the exit condition is never met. This is rarely a good idea.
yes
Infinite loop.
then your program will never ends, too unless you pressing the ctrl+c or kill it through your os. can i know the purpose of you creating the loop that never ends? is it just a mistake or are you doing it on purpose?
to prevent loose ends
If one loop ends before the next begins then they are not nested at all -- they are completely independent. To be nested, one loop must contain the other loop in its entirety. That is, the inner, nested loop must start and end within the outer, containing loop. Nested loop example (in C++): for( int x = 0; x < 10; ++x ) // outer loop { for( int y = 0; y < 10; ++y ) // inner loop (nested loop) { printf( "%d x %d = %d\r\n", x, y, x*y ); } // end of inner loop } // end of outer loop
The continue statement is not actually used when it is the last statement of the body of the loop. Plus: outside any loop it is rarely or never used.
Infinite loop.
What do you call a number that never ends
then your program will never ends, too unless you pressing the ctrl+c or kill it through your os. can i know the purpose of you creating the loop that never ends? is it just a mistake or are you doing it on purpose?
A finite loop executes a specific number of times based on its condition, while an infinite loop runs indefinitely without cessation. Finite loops have a predetermined endpoint, while infinite loops continue without a defined stopping condition until manually interrupted. Improperly written infinite loops can lead to system crashes or unresponsive programs.
A non-terminating decimal.
Twisted loop reins are simply reins that have a twisted loop at the ends where the reins attach to the bit.
A scarf without ends is called an infinity scarf because it is a continuous loop without distinct ends. It can be worn by looping it around the neck without any need to tie it or wrap it like a traditional scarf.
You don't, it never ends.
Most people call it the horizon.
it never ends
The for loop has an initializer, an end condition, a loop expression, and a body. The initializer always runs. If the end condition is not satisified, the loop ends or never starts. The loop expression runs at the end of each iteration. Note that the body of a for loop can run no times. The do while statement has a body and an end condition. The body is executed, and then the end condition determines if the loop will iterate. Like the for loop, the loop expression runs at the end of each iteration. Note that the body of a do while loop will run at least one time.
to prevent loose ends