answersLogoWhite

0

The main diff b/w while and do while is that for do while first the statment are exected then the condition is checked if the condition is true then again execute the statment and so on. But in case of while first the condition is checked if it is true then the statment are executed and so on. But in java the result of the condition is boolean eg. while(x=20) is not the condition in java it does not give any boolean answer.

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

Compare Do-While with While Statements?

A Do-While loop looks like this: do { loop body } while (condition); and a While loop looks like this: while (condition) { loop body } The main difference is that the loop body is always run once in the Do-While loop, then the condition is checked to see if the loop should keep running. In a While loop, the condition is checked first, and it will not run the loop body at all if the condition is false.


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 nested loop in java?

A nested loop is a (inner) loop that appears in the loop body of another (outer) loop. The inner or outer loop can be any type: while, do while, or for. For example, the inner loop can be a while loop while an outer loop can be a for loop.


What are the similarities of while loop and a do while loop?

They both loop


The while loop is a type of loop?

Is loop


What is the difference between do and while loops in c?

the main difference b/w do and while loops is that do loop will run atleast once even if condition is not satisfied but while loop will not execute even once if condition is not satisfied . this is bcoz in do loop condition is checked after one execution but in while condition is prechecked.


What is while . do statement?

Do while is a conditional statement which is used to check the certain condition and then perform the operation. usally the do word written first and the the loop occurs and then the while conditionoccurs. The main thing in case of do while is that it will perform the operation written in the loop at least once because it executes first and then check the condition. The syntax for the do -while loop can be as follows..... do { ............... ............... }while(-)


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


Definition of do loop while in visual basic?

There are 3 type of loop 1 is for loop 2 is loop while 3 is loop untile


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.


Can you write switch statement with in while loop?

Yes. The same goes for for-loop and do-while-loop.


How do you convert a while loop to do-while loop?

A for loop is classified as an iteration statement. A simple example might be... For x = 1 To 10 'loop body Next x The same loop expressed as a while loop (classified as a control flow statement) could be... x = 0 Do While x < 11 'loop body x = x + 1 Loop .