+ 2

What is the different between while and do .... while in pension?

3rd Oct 2017, 1:25 PM
zahra
zahra - avatar
2 Respostas
+ 16
As an example for Daniel's nice explanation, compare these two blocks, .... bool b1 = false; while (b1) { // condition at first cout << "Program flow skips this cout! "; } do { cout << "This cout is going to execute at least once! "; } while (b1); // condition at last
3rd Oct 2017, 2:53 PM
Babak
Babak - avatar
+ 4
while first check condition and next run instructions do while first run instructions and next check condition
3rd Oct 2017, 1:27 PM
Daniel
Daniel - avatar