while support

This commit is contained in:
oc 2018-05-09 13:03:45 +08:00
parent 9a4affda79
commit 6253ccb84a
2 changed files with 2 additions and 20 deletions

View File

@ -919,7 +919,7 @@ return code;
*/;
while_s
: '循环' ':' '当' expression '时' BGNL? Newline action+ BEND Newline
: '循环处理' '' '当' expression '时' BGNL? Newline action+ BEND Newline
/* while_s
tooltip : while循环处理
@ -943,7 +943,7 @@ return code;
*/;
continue_s
: '跳置当前循环的下一轮' Newline
: '继续当前循环' Newline
/* continue_s
tooltip : continue继续执行当前循环的下一轮, 如果continue事件不在任何循环中被执行则和exit等价即会立刻结束当前事件

View File

@ -1091,24 +1091,6 @@ choices为一个数组其中每一项都是一个选项列表。
使用 `{"type": "break"}` 可以跳出当前循环。
上面的输出例子也可以这么写:
``` js
"x,y": [ // 实际执行的事件列表
{"type":"while", "condition": "true", // 循环处理;永远为真
"data":[
{"type": "setValue", "name": "flag:i", "value": "flag:i+1"}, // 递增i
{"type": "if", "condition": "flag:i>10", // 测试i是否超过了10
"true": [{"type": "break"}], // 是的则直接break调出循环
"false": []
},
"${flag:i}", // 输出i
{"type": "sleep","time":1000}, // 等待1秒
]
},
]
```
!> 如果break事件不在任何循环中被执行则和exit等价即会立刻结束当前事件
### continue继续执行当前循环