+ 3
What is the difference between while loop and for loop?
4 Answers
+ 8
I would like to say "no difference"
bc
infinite loop:
while(true){cout << "Ahem";}
for(;true;){cout << "Ahem";}
Both of them will show result as infinite loop
More:
Those code can be shorten with
while(1){cout << "Moo ";}
for(;;){cout << "M0o ";}
+ 6
The difference isn't in the loop, but in the use for the loop. generally a while loop is run until a condition is met whereas a for loop is usually run a set amount of times
+ 3
@justin thank you đ now i got it
+ 2
thank you đ



