ISPSoft User Manual 13.2.11 EXIT Statement Format Description An EXIT statement is used in a REPEAT loop, a WHILE loop, or a FOR loop. It is used to exit the loop. Example Example 1: The loop below is a REPEAT loop. The loop will not be terminated until the value of DT1 is 0. The IF structure in the loop is used with an EXIT statement. The initial value in D0 is 0. It increases by 1. The loop will not be terminated until the value in D0 is 100. As a result, the loop body will be executed 100 times at most. In the example below, the initial value of DT1 is 110. After the loop body is executed for the 100 th time, the value of DT1 will become 10.
In other words, the final value of DT1 will be 10. The value of DT1 will not decrease to 0. Example 2: The loop below is a FOR loop. Originally, the arithmetic hierarchy is DT1 value (initial value is10) and the result of the operation is stored in D0. The IF structure in the loop is used with an EXIT statement. The loop will not be terminated until the value in D0 is larger than 100. When the value in D10 increases to 5, the value in D0 is 1*2*3*4*5=120, and the loop is terminated. 13-26