break
- Last UpdatedApr 24, 2024
- 1 minute read
The break statement terminates the execution of the closest enclosing Flow Control loop statements (for, foreach and while) and transfers the execution to the following statement, if any. In nested loops, break statement terminates only the execution of the innermost loop that contains it.
Example code
static void testBreak ()
{
foreach(string s in Runtime::Scene.EnumerateNodes("all"))
{
Runtime::Environment.Print(s);
if(s == "D")
break;
}
}
//Output displays the list of the name of nodes in the scene returned by EnumerateNodes(“all”) until D node is found.