while (foo() == true)
{
foreach (var x in xs)
{
if (bar(x) == true)
{
//"break;" out of this foreach
//AND "continue;" on the while loop.
}
}
//If I didn't continue, do other stuff.
}
我有点卡在如何做这件事情上。
更新:我修复了问题。我遗漏了一个事实,如果我不在while循环中调用continue;
,我需要处理其他东西。
抱歉,我没有意识到我两次使用了单词“something”。
break;
,while循环将继续,因为something is true
。 - Djolecontinue;
,我需要能够处理其他的项目。 - myermianforeach
循环时,您需要编写if(something)continue;
或使用goto label
。 - Djolefoo
和bar
仅用于它们的值,还是它们也具有副作用? - Eric Lippert