문제

Possible Duplicate:
In C# is a for(;;) safe and what does it really do?

So i recently came across something ive never seen before..

        for (; ; )
        {

        }

What is exactly happening when the feilds are left blank like that?

도움이 되었습니까?

해결책

It's an infinite loop.

Somewhere inside there should be a break; statement, or possibly an exception thrown in order for control to pass beyond the loop.

You could also achieve the same thing (probably more obviously) by doing

while (true)
{
    // do stuff
}

다른 팁

This is an infinite loop, almost equivalent to a while(true) loop.

The break condition is not there in between the two semicolons, therefore, it must be there somewhere in the loop body.

That's an infinite for loop.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top