+ 3
What is t h e difference between while and do- while loop
9 Réponses
+ 7
Bjarne Stroutstrup.
+ 5
do{
Statement;
}while(condition);
In this firstly loop gets started, then it checks the condition and now if it is not fulfilled, the loop terminates.
So, do while loop must be executed atleast once even if the condition is not true.
while(condition){
Statement;
}
It firsts check for the condition first and if it is fulfilled only then the loop will be executed.
+ 4
Thanks for answer
+ 3
while is entry controlled loop...whereas do while is exit controlled
+ 2
Please tell me i dont know....
+ 2
1. First check the condition, and if it returns true - execute the code in the block.
while (some condition) {
some code
}
It means, that the code in the block will never be executed, if the condition is false.
2. First execute the code in the do-while block, then check the condition.
do {
some code
} while (some condition);
Means, that the code will be executed at least once, even, if the condition is false.
+ 2
WHO IS THE FOUNDER OF C++??