I\'ve seen this in some JavaScript code but I don\'t get what it does.
for(;;){
//other code
}
I\'m used to the for(i=0;i
for (;;)
is the exact same syntax. You're allowed to leave out parts that go between the semicolons, even all of them. If you leave the condition out, it's assumed to be true
, so it results in an infinite loop. You can of course still exit with break
or return
or whatnot, hence making it not useless.