answersLogoWhite

0

while(condition) {

dosomestuff();

}

for(i = 0; i < 10; i++) {

dosomestuff();

}

User Avatar

Wiki User

10y ago

What else can I help you with?

Continue Learning about Engineering

What is normal exit in loops?

The condition requirements (target) of the conditional statement has been met.


What r conditional loops and unconditional loops in c?

A conditional loop will only continue to loop while the given condition is true: while( i &lt; 10 ) { ... } An unconditional loop either has no condition (a GOTO loop), or the condition is guaranteed to always evaluate to true: while( true ) { ... }


How do you do a nested loop using Qbasic?

There several methods: For/Next loop Do/While/Until loops You can have Do Loops within Do Loops.


Eg for forloop and while loop?

//Both loops will print out the alphabet {A-Z} int i = 65; while(i&lt;65+26) { System.out.println((char)i); i++; } ... for(int i=65; i&lt;65+26; i++) System.out.println((char)i); As you can see, both loops accomplish the same thing. A while loop simply has a conditional statement that tells the loop what needs to be true for it to keep on looping. A for loop is more concise: it has 3 parts: a starting value, a conditional statement, and a(n) action for what the loop should do after every iteration (in this case increase i by 1).


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.

Related Questions

What is normal exit in loops?

The condition requirements (target) of the conditional statement has been met.


Examples of Conditional statement?

if-then-else


What r conditional loops and unconditional loops in c?

A conditional loop will only continue to loop while the given condition is true: while( i &lt; 10 ) { ... } An unconditional loop either has no condition (a GOTO loop), or the condition is guaranteed to always evaluate to true: while( true ) { ... }


How do you do a nested loop using Qbasic?

There several methods: For/Next loop Do/While/Until loops You can have Do Loops within Do Loops.


How can loops be used to process arrays give examples?

How_can_loops_be_used_to_process_arrays


Which loop is most fastest in c plus plus?

In terms of performance there is no difference whatsoever. Which version you use is usually decided by which is more appropriate for the type of loop you want to execute. for() loops allow you to combine an initial condition, a conditional expression and a loop expression in a single statement. The initial condition can include a declaration which falls from scope when the loop ends, but all expressions are optional. If a conditional expression is not declared, a conditional expression must appear in the body of the loop. while() loops are similar to for() loops, but are generally used when an initial condition and loop expression are not required, but a condition is. The condition is non-optional. do..while() loops are used when a loop must execute at least once, and a condition is not optional.


How many loops in a mammals circulatory system?

it has 2 LOOPS ;)... ACCORDING TO THE BOOK


Which sites show examples of model train layouts?

There are a few sites that show examples of model train layouts. Two of these sites include YouTube and LayoutVision. These sights show examples and ideas from small to large layouts, loops, and track plans.


Does Excel have two types of conditional formatting?

You do Conditional Formatting based on a cell value or based on a formula.


Are bible promises conditional What are two scriptures that support that promises are conditional?

Many of the promises are conditional. Look for the word "If". There are others that are unconditional. These tend to be covenants God has made with his people.


How many loops on kraken in Orlando?

There are seven inversions, two of which are loops, and 3 of which are variants of the standard loop


What are some examples of truth conditional semantics?

Truth conditional semantics is a theory in linguistics that focuses on the relationship between the meaning of a sentence and its truth value. Examples of truth conditional semantics include analyzing how the truth of a sentence is determined by the truth values of its individual parts, such as words and phrases, and how logical operators like &quot;and,&quot; &quot;or,&quot; and &quot;not&quot; affect the overall truth value of a sentence.