From 6253ccb84a7dadaa104c6e1815534dc9c4f29e2b Mon Sep 17 00:00:00 2001 From: oc Date: Wed, 9 May 2018 13:03:45 +0800 Subject: [PATCH] while support --- _server/blockly/MotaAction.g4 | 4 ++-- docs/event.md | 18 ------------------ 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/_server/blockly/MotaAction.g4 b/_server/blockly/MotaAction.g4 index 0bf30228..c80796fc 100644 --- a/_server/blockly/MotaAction.g4 +++ b/_server/blockly/MotaAction.g4 @@ -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等价,即会立刻结束当前事件! diff --git a/docs/event.md b/docs/event.md index 8b63ae48..3e936426 100644 --- a/docs/event.md +++ b/docs/event.md @@ -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:继续执行当前循环