while support
This commit is contained in:
parent
9a4affda79
commit
6253ccb84a
@ -919,7 +919,7 @@ return code;
|
|||||||
*/;
|
*/;
|
||||||
|
|
||||||
while_s
|
while_s
|
||||||
: '循环' ':' '当' expression '时' BGNL? Newline action+ BEND Newline
|
: '循环处理' ':' '当' expression '时' BGNL? Newline action+ BEND Newline
|
||||||
|
|
||||||
/* while_s
|
/* while_s
|
||||||
tooltip : while:循环处理
|
tooltip : while:循环处理
|
||||||
@ -943,7 +943,7 @@ return code;
|
|||||||
*/;
|
*/;
|
||||||
|
|
||||||
continue_s
|
continue_s
|
||||||
: '跳置当前循环的下一轮' Newline
|
: '继续当前循环' Newline
|
||||||
|
|
||||||
/* continue_s
|
/* continue_s
|
||||||
tooltip : continue:继续执行当前循环的下一轮, 如果continue事件不在任何循环中被执行,则和exit等价,即会立刻结束当前事件!
|
tooltip : continue:继续执行当前循环的下一轮, 如果continue事件不在任何循环中被执行,则和exit等价,即会立刻结束当前事件!
|
||||||
|
|||||||
@ -1091,24 +1091,6 @@ choices为一个数组,其中每一项都是一个选项列表。
|
|||||||
|
|
||||||
使用 `{"type": "break"}` 可以跳出当前循环。
|
使用 `{"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等价,即会立刻结束当前事件!
|
!> 如果break事件不在任何循环中被执行,则和exit等价,即会立刻结束当前事件!
|
||||||
|
|
||||||
### continue:继续执行当前循环
|
### continue:继续执行当前循环
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user