+ 1
Hey,guys what are the real difference between the for,while and do...while loop..!!?
Loops differences
4 Respuestas
+ 2
Well,thanks
+ 1
I don't know the official difference but what I learned using them is
For loop:
All the conditions and increment values are in one place so its pretty good for writing simple codes.
While and do while have major difference.
With. do{
//something
} while(condition);
No matter what the condition is(true/false) loop will run once(execute what's inside of do).
While and for doesn't have much of difference than the option to put the increment value inside the loop.
+ 1
thanks
0
Akib Reza , addition to whatever is shared,
do while is used when you need to execute your code at least once...
As index is not present in while and do while loop, it's better to use for loop when you need index of each item being visited...
HIH Chidy Ommy