+ 1

Hey,guys what are the real difference between the for,while and do...while loop..!!?

Loops differences

31st Jul 2018, 7:46 AM
Rashid Shakili
Rashid Shakili - avatar
4 Answers
+ 2
Well,thanks
31st Jul 2018, 10:24 AM
Rashid Shakili
Rashid Shakili - avatar
+ 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.
31st Jul 2018, 7:57 AM
Akib
Akib - avatar
+ 1
thanks
31st Jul 2018, 8:24 AM
Rashid Shakili
Rashid Shakili - avatar
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
31st Jul 2018, 10:18 AM
Ketan Lalcheta
Ketan Lalcheta - avatar