正在加载文档

FOR循环脚本命令

最后更新:2026-08-11 21:07
<!-- mindoc:slug=aa-1hglonr615rso --> # For循环 ### 格式: >For 参数1 参数2 ### 参数说明: |位置|说明|备注| |:----|:---|:--- |参数1 |变量 || |参数2 |判断参数|| >说明:该命令需要搭配`EndFor`使用,循环体支持多层嵌套,循环体变量每次自动+1。 例子比较详细,可详细查看。 ### 示例: ``` [@For循环测试一] #IF #ACT MOV P1 0 SENDMSG 5 ---begin For P1 5 SENDMSG 6 循环体==【<$STR(P1)>】 EndFor SENDMSG 5 --end break [@For循环测试二] #IF #ACT MOV P1 0 MOV P2 0 SENDMSG 5 ---begin For P1 5 SENDMSG 6 循环体==【<$STR(P1)>】 goto @测试goto EndFor SENDMSG 5 --退出循环 break [@测试goto] #IF #ACT MOV P2 0 For P2 5 SENDMSG 6 goto循环体【<$STR(P1)>】==[<$STR(P2)>] EndFor SENDMSG 7 goto循环体结束 [@For循环测试三] #IF #ACT MOV P3 0 MOV P4 0 SENDMSG 5 ---begin For P3 5 SENDMSG 6 循环体[1]==【<$STR(P3)>】 EndFor MOV P4 0 SENDMSG 5 ----begin For P4 5 SENDMSG 6 循环体[2]==【<$STR(P4)>】 EndFor [@For循环测试四] #IF #ACT SENDMSG 5 ---begin MOV P3 0 For P3 5 MOV P4 0 For P4 5 MOV P5 0 For P5 5 SENDMSG 6 循环体==【<$STR(P3)>】【<$STR(P4)>】【<$STR(P5)>】 EndFor EndFor EndFor ```
0.059540s