diff options
| author | Li Jin <dragon-fly@qq.com> | 2026-02-24 16:02:05 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2026-02-24 16:02:05 +0800 |
| commit | afc2eba9d73a43d2f3080cf12be4ffe977a79414 (patch) | |
| tree | 7d07be9dd9150d1eaa08caddcf3e7f88acb5396a /doc/yue-en.md | |
| parent | 0ccf4408271c8a0d147e3cf25689810862e8c1db (diff) | |
| download | yuescript-afc2eba9d73a43d2f3080cf12be4ffe977a79414.tar.gz yuescript-afc2eba9d73a43d2f3080cf12be4ffe977a79414.tar.bz2 yuescript-afc2eba9d73a43d2f3080cf12be4ffe977a79414.zip | |
Updated docs. [skip CI]
Diffstat (limited to 'doc/yue-en.md')
| -rw-r--r-- | doc/yue-en.md | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/doc/yue-en.md b/doc/yue-en.md index 764bc1a..a82ae9a 100644 --- a/doc/yue-en.md +++ b/doc/yue-en.md | |||
| @@ -15,18 +15,6 @@ do | |||
| 15 | print var -- nil here | 15 | print var -- nil here |
| 16 | ``` | 16 | ``` |
| 17 | 17 | ||
| 18 | YueScript's **do** can also be used an expression . Allowing you to combine multiple lines into one. The result of the do expression is the last statement in its body. | ||
| 19 | |||
| 20 | `do` expressions also support using `break` to interrupt control flow and return multiple values early: | ||
| 21 | |||
| 22 | ```yuescript | ||
| 23 | status, value = do | ||
| 24 | n = 12 | ||
| 25 | if n > 10 | ||
| 26 | break "large", n | ||
| 27 | break "small", n | ||
| 28 | ``` | ||
| 29 | |||
| 30 | ```yuescript | 18 | ```yuescript |
| 31 | counter = do | 19 | counter = do |
| 32 | i = 0 | 20 | i = 0 |
| @@ -46,6 +34,18 @@ tbl = { | |||
| 46 | } | 34 | } |
| 47 | ``` | 35 | ``` |
| 48 | 36 | ||
| 37 | YueScript's **do** can also be used an expression . Allowing you to combine multiple lines into one. The result of the do expression is the last statement in its body. | ||
| 38 | |||
| 39 | `do` expressions also support using `break` to interrupt control flow and return multiple values early: | ||
| 40 | |||
| 41 | ```yuescript | ||
| 42 | status, value = do | ||
| 43 | n = 12 | ||
| 44 | if n > 10 | ||
| 45 | break "large", n | ||
| 46 | break "small", n | ||
| 47 | ``` | ||
| 48 | |||
| 49 | # Line Decorators | 49 | # Line Decorators |
| 50 | 50 | ||
| 51 | For convenience, the for loop and if statement can be applied to single statements at the end of the line: | 51 | For convenience, the for loop and if statement can be applied to single statements at the end of the line: |
| @@ -870,7 +870,7 @@ with tb | |||
| 870 | 870 | ||
| 871 | ```yuescript | 871 | ```yuescript |
| 872 | with? obj | 872 | with? obj |
| 873 | print obj.name | 873 | print .name |
| 874 | ``` | 874 | ``` |
| 875 | 875 | ||
| 876 | # Assignment | 876 | # Assignment |
