奇怪的 for 循环? C#
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是一个无限循环。
内部某处应该有一个
break;
语句,或者可能抛出一个异常,以便控制传递到循环之外。你也可以通过做来实现同样的事情(可能更明显)
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)
循环。break
条件不在两个分号之间,因此,它必须位于循环体中的某个位置。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.