aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2022-07-14 03:42:21 +0800
committerLi Jin <dragon-fly@qq.com>2022-07-14 03:42:21 +0800
commitc6946ca162911036a19cc7c5deadb6d8c127755e (patch)
treee728f31693d7fb1da3b5fca7f4ac5656392cf1f3 /doc
parent3159a45de9e691ad758dcbc933446f61b7ae1940 (diff)
downloadyuescript-c6946ca162911036a19cc7c5deadb6d8c127755e.tar.gz
yuescript-c6946ca162911036a19cc7c5deadb6d8c127755e.tar.bz2
yuescript-c6946ca162911036a19cc7c5deadb6d8c127755e.zip
update doc and changelog.v0.13.4
Diffstat (limited to 'doc')
-rwxr-xr-xdoc/docs/doc/README.md16
1 files changed, 10 insertions, 6 deletions
diff --git a/doc/docs/doc/README.md b/doc/docs/doc/README.md
index ef00c23..90cb309 100755
--- a/doc/docs/doc/README.md
+++ b/doc/docs/doc/README.md
@@ -2343,19 +2343,23 @@ for item in *items
2343You can use default values to optionally destructure the table for some fields. 2343You can use default values to optionally destructure the table for some fields.
2344 2344
2345```moonscript 2345```moonscript
2346item = x: 100 2346item = {}
2347
2348{pos: {:x = 50, :y = 200}} = item -- get error: attempt to index a nil value (field 'pos')
2347 2349
2348switch item 2350switch item
2349 when {:x, :y = 200} 2351 when {pos: {:x = 50, :y = 200}}
2350 print "Vec2 #{x}, #{y}" -- table matching will pass 2352 print "Vec2 #{x}, #{y}" -- table destructuring will still pass
2351``` 2353```
2352<YueDisplay> 2354<YueDisplay>
2353<pre> 2355<pre>
2354item = x: 100 2356item = {}
2357
2358{pos: {:x = 50, :y = 200}} = item -- get error: attempt to index a nil value (field 'pos')
2355 2359
2356switch item 2360switch item
2357 when {:x, :y = 200} 2361 when {pos: {:x = 50, :y = 200}}
2358 print "Vec2 #{x}, #{y}" -- table matching will pass 2362 print "Vec2 #{x}, #{y}" -- table destructuring will still pass
2359</pre> 2363</pre>
2360</YueDisplay> 2364</YueDisplay>
2361 2365