Posts: 534
Threads: 265
Joined: Jul 2014
Hi,
Код:
foreach(new i : Player)
{
for(new n = 0; n < 5; n ++)
{
if( n == 3 )
{
break;
}
}
}
It'is example script. It'is corrent and break cikle when n will be 3 and foreach cikle will be going next ?
Posts: 983
Threads: 98
Joined: Feb 2012
Reputation:
0
I believe that the foreach will continue.
Posts: 534
Threads: 265
Joined: Jul 2014
But it will break and foreach cikle too ?
Posts: 983
Threads: 98
Joined: Feb 2012
Reputation:
0
According to your assumption, whenever a code sees 'break' it gets out of the shape or title and runs the next code..
though, I don't think that the foreach will break anyway.. I think that the For loop will alone
Posts: 10,066
Threads: 38
Joined: Sep 2007
Reputation:
0
A break statement only affects the innermost loop. Some languages have constructs to specify which loop should be broken, but Pawn does not have such construct.