该帮助的版本不再更新,请参见https://www.jmp.com/support/help/zh-cn/15.2 获取最新的版本.


The Break() and Continue() functions give you more control over looping. Break() immediately stops the loop and proceeds to the next expression that follows the loop. Continue() is a gentler form of Break(). It immediately stops the current iteration of the loop and continues with the next iteration of the loop.
Break() is typically used inside a conditional expression. For example:
For( i = 1, i <= 5, i++,
If( i == 3, Break() );
Print( "i=" || Char( i ) );
Begins the For() loop.
Sets i to 1.
As long as i is less than or equal to 5, continues evaluating the loop.
Increments i by 1. Note that this step is done after the If loop is evaluated.
Begins the If() loop.
If i is equal to 3, breaks the loop.
When i is not equal to 3, opens the Print() loop.
Prints the string "i=" to the log.
Places "i=" on the same line as the value that follows.
The For() loop then repeats until the value of i is less than or equal to 5, breaking when i equals 3, and breaking and printing only when i is less than 3.
Note that when the If() and Break() expressions follow Print(), the script prints the values of i from 1 to 3, because the loop breaks after "i=3" is printed.
As with Break(), Continue() is typically used inside a conditional expression. For example:
For( i = 1, i <= 5, i++,
If( i < 3, Continue() );
Print( "i=" || Char( i ) );
Begins the For() loop.
Sets i to 1.
Increments i by 1. Note that this step is done after the If loop is evaluated.
Begins the If() loop.
Evaluates i as 1 and continues as long as i is less than 3.
Ends the If() loop.
When i is no longer less than 3, opens the Print() loop.
Prints the string "i=" to the log.
Places "i=" on the same line as the value that follows.
The For() loop then repeats until the value of i is less than or equal to 5, continuing and printing only when i is equal to or greater than 3.