发布于 2003-08-18 08:54:57
0楼
The FOR (FOR) instruction executes the instructions between the FOR and the NEXT. You specify the index value or current loop count (INDX), the starting value (INIT), and the ending value (FINAL).The NEXT (NEXT) instruction marks the end of the FOR loop, and sets the top of the stack to 1.Use the FOR/NEXT instructions to delineate a loop that is repeated for the specified count. Each FOR instruction requires a NEXT instruction. You can nest FOR/NEXT loops (place a FOR/NEXT loop within a FOR/NEXT loop) to a depth of eight.For example, given an INIT value of 1 and a FINAL value of 10, the instructions between the FOR and the NEXT are executed 10 times with the INDX value being incremented: 1, 2, 3, ...10.If the starting value is greater than the final value, the loop is not executed. After each execution of the instructions between the FOR and the NEXT instruction, the INDX value is incremented and the result is compared to the final value. If the INDX is greater than the final value, the loop is terminated.