如何在突出顯示的行中分解兩個for循環。如何分解兩個循環
bool conditionitem = true;
for (int cun = 0; cun < ItemIdNumber.Length; cun++)
{
int Item_Id = Convert.ToInt32(ItemIdNumber[cun]);
for (int yyu = 0; yyu <= 1258038; yyu++)
{
int weer = c[yyu];
if (weer == Item_Id)
{
conditionitem = false;
itemseq = yyu;
}
}
if (conditionitem != false)
{
MessageBox.Show("THE ITEM ID DOES NOT EXIST.!");
break; //--> here i want two break for two times
}
}
通過該(表示MessageBox.Show("THE ITEM ID DOES NOT EXIST.!");
之後)打破它僅破壞第一回路。
重複:http://stackoverflow.com/questions/324831/breaking-out-of-a-nested-loop –
可能重複[如何從雙/嵌套循環中的主/外循環?]( http://stackoverflow.com/questions/13073300/how-to-break-from-main-outer-loop-in-a-double-nested-loop) – rpax
我不明白這一點,你已經在外面循環。 –