answersLogoWhite

0

The while loop is a pre-condition loop.  It tests the condition at the beginning of each loop, executes the loop if it is true, and goes back to the test after executing each iteration.

User Avatar

Wiki User

13y ago

What else can I help you with?

Continue Learning about Engineering

Is a for loop a post-test loop?

Yes. The second clause (the condition) is evaluated before each iteration through a loop. It is possible that a for loop will not execute if its precondition is not met. For example, "for( int x = 5; x < 5; x++ )" will not iterate even once.


What the difference between pretest loop and posttest loops?

The difference is that pre means before and post means after in Latin so it's tested before or after. :)


Is the for loop a pretest type of loop?

Pretest loops, such as for-loop, while-loop, execute/evaluate the condition statement first, if the condition is met, then the statements of the loop are executed. If you were referring to the body of the loop being carried out at least once, no, the body will not be touched if the condition fails (pre-test, test BEFORE the [next] execution of the body). But the condition of the loop must have been evaluated at least once.In contrast to the post-test loops, such as do-while, repeat-until, the condition is evaluated AFTER the [next] execution of the body. It is possible that the condition is never evaluate, and not the entire loop body being executed.


What is the different between loop and do while loop?

no difference in logic in both of them you put the key to enter :while( ....),for(;....;) but infor loop you have option to initialize value and make operation on it for(int i=0;...;i++){} same int i=0; while(..){ i++;}


What are the three parts that make up a loop structure?

ditioFor loops are a little more complex then the While loop. A for loop as 3 optional parameters. They are the initializer list, the conditional check, and the post incrementer list. The initializer list is the section that you declare variables and/or initialize them to a specific value. The conditional check is the conditional check for the loop to continue or finish. The post incrementer list is a section that is used to apply post loop code. Once each iteration of the loop is complete, these lines of code are called to update variables or conditions. Then the loop runs againns. Then the loop runs again

Related Questions

Is a for loop a post-test loop?

Yes. The second clause (the condition) is evaluated before each iteration through a loop. It is possible that a for loop will not execute if its precondition is not met. For example, "for( int x = 5; x < 5; x++ )" will not iterate even once.


What the difference between pretest loop and posttest loops?

The difference is that pre means before and post means after in Latin so it's tested before or after. :)


Is the for loop a pretest type of loop?

Pretest loops, such as for-loop, while-loop, execute/evaluate the condition statement first, if the condition is met, then the statements of the loop are executed. If you were referring to the body of the loop being carried out at least once, no, the body will not be touched if the condition fails (pre-test, test BEFORE the [next] execution of the body). But the condition of the loop must have been evaluated at least once.In contrast to the post-test loops, such as do-while, repeat-until, the condition is evaluated AFTER the [next] execution of the body. It is possible that the condition is never evaluate, and not the entire loop body being executed.


What is the syntax of do in a flowchart?

Do while is a post test loop. Here in flow chart first the stmts 2 b xecuted r done and the condition is tested next using if condition.


What is the different between loop and do while loop?

no difference in logic in both of them you put the key to enter :while( ....),for(;....;) but infor loop you have option to initialize value and make operation on it for(int i=0;...;i++){} same int i=0; while(..){ i++;}


What are the three parts that make up a loop structure?

ditioFor loops are a little more complex then the While loop. A for loop as 3 optional parameters. They are the initializer list, the conditional check, and the post incrementer list. The initializer list is the section that you declare variables and/or initialize them to a specific value. The conditional check is the conditional check for the loop to continue or finish. The post incrementer list is a section that is used to apply post loop code. Once each iteration of the loop is complete, these lines of code are called to update variables or conditions. Then the loop runs againns. Then the loop runs again


What is the do while loop in C programming?

In most computer programming languages, a do while loop, sometimes just called a do loop, is a control flow statement that allows code to be executed repeatedly based on a given Boolean condition. Note though that unlike most languages, Fortran's do loop is actually analogous to the for loop.The do while construct consists of a block of code and a condition. First, the code within the block is executed, and then the condition is evaluated. If the condition is true the code within the block is executed again. This repeats until the condition becomes false. Because do while loops check the condition after the block is executed, the control structure is often also known as a post-test loop. Contrast with the while loop, which tests the condition before the code within the block is executed.It is possible, and in some cases desirable, for the condition to always evaluate to true, creating an infinite loop. When such a loop is created intentionally, there is usually another control structure (such as a break statement) that allows termination of the loop.Some languages may use a different naming convention for this type of loop. For example, the Pascal language has a "repeat until" loop, which continues to run until the control expression is true (and then terminates) - whereas a "do-while" loop runs while the control expression is true (and terminates once the expression becomes false).


Do while loop uses?

The DO WHILE loop is like the WHILE loop very much, except for one thing. The WHILE loop is like an IF loop but it keeps on going. The WHILE loop needs to start, so the beginning, when you are setting the conditions, is exactly the same. When the WHILE loop is done, it goes back to right before the conditions. The DO WHILE loop starts the WHILE loop so that you can have a WHILE loop that does not start with conditions, but instead, needs conditions to keep on going. This might not be the exact syntax, because if it doesn't work try it without the semicolon after the while. And anyways, if that doesn't work, I started with C++, not C.doCONTENTwhile(CONDITIONS);The WHILE loop goes back to the DO if the conditions are matched. The DO happens without any conditions.:) :) :)


a for loop is a post test loop?

pre-test


Why is the DO loop called a pre-test loop?

No reason. It is a post-test loop.


What is pretext and post text loop processing?

It is 'pre-test' and 'post-test'.


When you post a car for sale but cannot guarantee its condition.?

Then post it "As Is".