aboutsummaryrefslogtreecommitdiff
path: root/spec/inputs
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2025-05-21 11:44:54 +0800
committerLi Jin <dragon-fly@qq.com>2025-05-21 11:44:54 +0800
commit0603800a4114ed8b4c9572a7d7852995c9b9f334 (patch)
tree456524685562bcd0d874530e3ddc2a0fc0731525 /spec/inputs
parentff137ac73d999a5849f02706cfd52f4659b025ef (diff)
downloadyuescript-0603800a4114ed8b4c9572a7d7852995c9b9f334.tar.gz
yuescript-0603800a4114ed8b4c9572a7d7852995c9b9f334.tar.bz2
yuescript-0603800a4114ed8b4c9572a7d7852995c9b9f334.zip
Added break with value syntax.
Diffstat (limited to 'spec/inputs')
-rw-r--r--spec/inputs/loops.yue39
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/inputs/loops.yue b/spec/inputs/loops.yue
index c5b28b3..9a91b42 100644
--- a/spec/inputs/loops.yue
+++ b/spec/inputs/loops.yue
@@ -213,3 +213,42 @@ do
213do 213do
214 until x := func 'a', b do 214 until x := func 'a', b do
215 print "false expected" 215 print "false expected"
216
217do
218 index = for i = 1, #tb
219 break i if tb[i]
220
221 f for i = 1, #tb
222 break i if tb[i]
223
224 f for i = 1, #tb
225 i if tb[i]
226
227 i = 1
228 ids = while tb[i]
229 i += 1
230 i - 1
231
232 i = 1
233 idx = while tb[i]
234 i += 1
235 break i - 1
236
237 f1 = ->
238 i = 1
239 f while tb[i]
240 i += 1
241 i - 1
242
243 i = 1
244 f while tb[i]
245 i += 1
246 break i - 1
247
248 list = for item in *items
249 switch item
250 when type: "A", :value
251 if value > 5
252 item
253
254