适用于for 、 while 、 do… while
(while循环和do-while循环)
以下只用for 来做例子
for ( int i = 0; i < 10, i++)
{
//if (something[i].aint == 0)
if ( i == 4)
{
break;
}
Debug.Log(i);
}
—> 0 1 2 3
运行到break时,结束当前循环。
for ( int i = 0; i < 10, i++)
{
//if (something[i].aint == 0)
if ( i == 4)
{
continue;
}
Debug.Log(i);
}
—> 0 1 2 3 5 6 7 8 9
运行到continue时,跳过本次循环进行下一次循环。
运行到return时,结束当前Void。