answersLogoWhite

0


Best Answer

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++;}

User Avatar

Wiki User

15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

15y ago

first be sure what u r asking? if just u mention it as loop what shall i take is tat for loop,do while? while first check the condition and then start execute the comming steps.but do while ll start the coding and then check for the condition. Rgds, BM

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

The while statement loops until the expression is false. If the expression is false to start with, the statement never executes, not even once. The expression is evaluated the first (and subsequent) times - if it has side effects, then they apply even if the expression is false to start with.

This answer is:
User Avatar

User Avatar

Wiki User

9y ago

It is also called as pretest loop.It executes the block of code after evaluation of condition in while statement.If evaluated answer is true,it will executes the block of code otherwise it will quit the loop.

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

The while loop will check the condition and then execute the body of loop. In the do-while loop the body is executed first and then the condition in while is checked. The advantage of the do-while loop is where you want to execute the body of while atleast once.

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

The do-while loop is a looping structure. This looping structure is an exit controlled loop. that means the loop executes at-least once before the test expression is checked.

The general form of do-while loop is:

do

{

statement1

statement2

}

while (expression)

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

according to my view for loop is best,because in FOR loop assign values,condition and update write in single line.it overcomes syntax error.

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

It's like fruit (loop) and apple (do-while loop).

This answer is:
User Avatar

User Avatar

shokat ali

Lvl 2
2y ago

post - iterative

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the different between loop and do while loop?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is main different between do while and while?

If you want to execute a statement which is in while loop at least one time you can use do- while loop. this is why because initially first statements will be executed then condition will be checked. but in case of while first condition will be check then statements will be executed


What is a loop type?

A Loop is a programming language construct that instructs the processor to repeat a sequence of operations a number of times until a specific condition is reached. There are different types of loops. They are: * for loop * while loop * do while loop


Why you need a for loop when you have already while loop or do while loop?

We need a for loop because the while and do-while loops do not make use of a control variable. Although you can implement a counter inside a while or do-while loop, the use of a control variable is not as self-evident as it is in a for loop. Aside from the use of a control variable, a for loop is largely the same as a while loop. However, it is quite different to a do-while loop, which always executes at least one iteration of the loop before evaluating the conditional expression. In a for and while loop, the conditional expression is always evaluated before entering the loop, which may result in the loop not executing at all.


What is the difference between a for loop and a while loop in java?

ComparisonThe conditions for both the 'while' and 'for' loop are exactly the same, but in each flow structure the conditions are placed in different locations. A 'for' loop places the full condition within the 'for' loop whereas the 'while' loop places the counter variable outside of the loop.The 'for' loop is used when the length of the loop is known whereas the 'while' loop is usually used when the length of the loop is unknown.'for' loop exampleWithin the parentheses the complete condition is contained. The condition has 3 parts delimited by a colon ';'. The first part sets the counter 'int i' to 0, the second part tells the loop to stop when the counter is 5. The third part tells java to increment the counter by 1 value each time the loop iterates.for ( int i = 0; i < 5; i++)'while' loop exampleWith the 'while' loop the counter is initialized outside of the 'while' loop. Inside the parentheses of the loop the condition is set to stop looping when the counter reaches a value of 5. Inside of the 'while' loop block the counter is set to increment by 1 value each time the loop iterates.int i = 0;while ( i < 5 ) {i++}


What are the statements that appear between the while and the end while clauses called?

Body of the loop

Related questions

What is the difference between while loop and for loop in oracle?

You mean PL/SQL? Well, they are different things, read the manual for details.


What is main different between do while and while?

If you want to execute a statement which is in while loop at least one time you can use do- while loop. this is why because initially first statements will be executed then condition will be checked. but in case of while first condition will be check then statements will be executed


What is a loop type?

A Loop is a programming language construct that instructs the processor to repeat a sequence of operations a number of times until a specific condition is reached. There are different types of loops. They are: * for loop * while loop * do while loop


What is the difference between a do while loop and a for loop in c?

the counter variable cannot be initialized in while loop before entering into the block.


Can while loop and for loop give different outputs?

Sure. Here is an example: for (i=0; i&lt;3; ++i) printf ("I am for loop, i=%d\n"); i=1; while (i&gt;0) { printf ("I am while loop, i=%d\n"); i &lt;&lt;= 1; }


How is the first loop in the circulatory system of an adult amphibian different from the second loop?

Tadpole has two chambered heart and a single-loop system while the adult has a three chambered heart and a double-loop system


What is the Difference between while and do while?

Both are programming commands. A do/while loop will execute at least once. A while loop may not execute at all.


Why you need a for loop when you have already while loop or do while loop?

We need a for loop because the while and do-while loops do not make use of a control variable. Although you can implement a counter inside a while or do-while loop, the use of a control variable is not as self-evident as it is in a for loop. Aside from the use of a control variable, a for loop is largely the same as a while loop. However, it is quite different to a do-while loop, which always executes at least one iteration of the loop before evaluating the conditional expression. In a for and while loop, the conditional expression is always evaluated before entering the loop, which may result in the loop not executing at all.


What is the difference between if and while loop?

Easy: if-else is not a loop; while, for and do-while are loops.if-else just run once, but do-while run many times.


Difference between for and while loop not in syntactically?

Well 'while' goes like this: while (condition) statement 'for': for (initialize; condition; after-each-loop) statement


Difference between while and do while loops in java?

The most important differences are: a. The while loop starts with a condition whereas the condition is the line of code in case of a do while loop b. The do while loop is guaranteed to run the loop body atleast once even if the condition is an impossible to satisfy but such a guarantee is not available with the normal while loop


List out the differences between while and dowhile statement?

The do ..while loop is executed at least once, whereas the while loop may not be executed even once.