answersLogoWhite

0


Best Answer

By adding in a check that can be fulfilled within the loop.

Example:

while x < 10

x ++;

get_cookie(1);

endwhile

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How are endless loops avoided?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Why it is necessary to avoid infinite loop in program design?

It is not necessary to avoid infinite loops. You are perhaps confusing infinite loops with endless loops which are to be avoided at all costs. An endless loop is an infinite loop that has no reachable exit condition; the loop will iterate until we forcibly terminate the program. We use the the term infinite loop in the sense that it is impossible to measure or calculate when the exit point will be hit. the following are all examples of infinite loops in their simplest form: for (;;) { // ... } while (true) { // ... } do while (true) { // ... } endless: // ... goto endless; The conditional expressions in each of these loops can never be false thus we cannot easily determine when these loops will exit. We typically use infinite loops when there are many exit conditions to consider and it is either impractical or inefficient to evaluate all of those conditions via the controlling expression alone. We take it as read the exit conditions are contained within the body of the loop. If the body of the loop has no reachable exit condition then it becomes an endless loop. It is the programmer's responsibility to ensure that all infinite loops can exit at some point.


Which IP packet field wiil prevent endless loops?

Time -to-live


How are endless loops of packets prevented?

A packet will not go around networks endlessly because it has a field in the header called the TTL field. This is a number that limits the number of hops or networks a packet will be forwarded to.


Give best quotation that relates to Penelope and Odysseus endless affair?

endless-fertile endless-disoderly endless-caring endless-expand endless-destroy endless-limited and endless-painless


Where is froot loops?

Fruit loops is in the pantry.


What are loops on garageband?

Garageband Loops are prerecorded instrumental sections for you to use in your projects. You can find them in Library&lt;Audio&lt;Apple Loops&lt;Apple&lt;Apple Loops for GarageBand


Is the Swarm at Thorpe Park going to have loops?

By loops do you mean a vertical loop, or inversion? They will have inversions, but no loops.


Is Fruit Loops vegan?

Fruit Loops are indeed vegan!


How much loops are there at the montu ride?

7 inversions (loops).


When did Lightnin' Loops end?

Lightnin' Loops ended in 1987.


When was Lightnin' Loops created?

Lightnin' Loops was created in 1978.


When was The Disintegration Loops created?

The Disintegration Loops was created in 1982.