+ 1
for( ; ; ;) in Java
How many times does this execute: for(;;;) { //some code } Can someone please explain how and why(I mean no initialization, no condition, no increment)? Thanks in advance.
2 odpowiedzi
+ 6
infinite
all condition are true
+ 1
you can initialize the loop variable before for loop e.g. var i=0;
then u can increment or decrement inside the loop.
finally u can exit using break with if condition.
this way, the loop wont run infinitely.