Break
General Control Statement
The Break statement exits out of a While loop or an Until loop when a specified condition is met. Use the Break statement when you want to define additional Boolean expressions to end a While loop or Until loop on top of the Boolean expression included in the initial While or Until Logic.
Syntax
Break
Examples
{
While/Until <Boolean expression 1> Do
{
<statement>
}
If <Boolean expression 2> Then
{
Break
}
}
{
While Var1 < 100 Do
{
Wait 5 sec
}
If Var1 = 87 Then
{
Break
}
}
Parameters
While/Until <Boolean expression 1> Do
<statement>
Include the Break statement within a While loop or an Until loop.
If <Boolean expression 2> Then Break
The Break statement is usually inside an If Then statement, too.
Example
The following statements...
{
While Var1 > 5 Do
Wait 10 min
If Attr1 = 10 Then Break
}
Display "Loop has ended"
...are defined in the Logic of a Location. Subsequently, the statement within the While loop, Wait 10 min, continues to execute as long as the Var1 vlaue is greater than 5. Once the Var1 value is less than 5, the While loop ends. Additionally, because of the Break statement, the While loop also ends when the value of Attr1 is equal to 10. Once the While loop ends for either reason, the Logic moves on to the next statement after the loop, and so the message ’Loop has ended’ appears.
For more information on the statements used in this example, see the Wait, Display and If ...Then Statements sections of this guide.
Remarks
Once a Break statement is executed, the Logic moves on to the next statement defined after the While or Until loop. If a Break is encountered outside any loop, then ProModel exits the entire Logic.
For more information about how If Then statements function, see the If ...Then Statements section of this guide.