answersLogoWhite

0

A loop is a section of code that is repeated over and over until some condition is met. There are different flavors:

A for loop:

for (a = 0; a < 25; a++)

{

//code

}

The //code will be executed with a=0, then a=1, etc., until a=25, when it will break out of the loop.

a = false

do

{

//code

} while (a == false)

Here, if there is nothing in //code to change the value of a to true, you will have an infinite loop.

User Avatar

Wiki User

16y ago

What else can I help you with?

Related Questions

What is the time complexity of using a while loop inside a for loop?

The time complexity of using a while loop inside a for loop is O(nm), where n is the number of iterations of the for loop and m is the number of iterations of the while loop.


What is purpose of break statement?

to terminate a loop.


What is thought with meaning?

Thought must have a purpose or it becomes an endless loop. When you think, do so with purpose.


Flow chart using for loop?

There's a nice for Loop at the link below.


How do you exit in nested loop in java?

You may exit a nested loop in Java using a break with a label for the outer loop.


How can you create a loop using a knot?

To create a loop using a knot, you can make a simple overhand knot in a rope or string and leave a small loop at the end. This loop can be used for various purposes such as attaching a hook or securing an object.


Fibonacci series using for loop in HTML?

HTML has no notion of a loop. This cannot be done.


What is the primary purpose of a loop?

to prevent loose ends


What is the purpose of flaming the loop after use?

I'm assuming you mean an "innoculating loop" in microbiology. You flame the loop to kill the microoganisms on the loop before using it again to prevent mixing different bacterial colonies and contaminating them.


How do you print square using for loops?

how to print "square" using for loop


What is the purpose of a high loop in a dishwasher drain hose?

The purpose of a high loop in a dishwasher drain hose is to prevent backflow of water from the sink into the dishwasher. This loop creates a barrier that stops dirty water or debris from flowing back into the dishwasher, ensuring that it stays clean and functions properly.


How does loop work?

In programming, a loop works by conditionally jumping to the start of the loop and repeating the instructions. If the condition evaluates false, execution continues to the next instruction, thus breaking out of the loop. We can also break out of a loop from within the body of the loop itself using another conditional jump which jumps out of the loop. If we jump backwards out of a loop we effectively create an intertwined loop, known as spaghetti code which is difficult to read and maintain. Structured loops help make it easier to digest the logic. In C, a jump is achieved using a goto and a label. However, structured loops using for, while and do-while statements make loops much easier to read and maintain.