diff options
author | Li Jin <dragon-fly@qq.com> | 2025-05-21 15:42:03 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2025-05-21 15:42:03 +0800 |
commit | d4b7efe3f48b40d108754d2e8359fee1cd9dded8 (patch) | |
tree | 2ec4133a47b947ec78d12076f981aa38d3b569c6 /doc/docs | |
parent | 0603800a4114ed8b4c9572a7d7852995c9b9f334 (diff) | |
download | yuescript-d4b7efe3f48b40d108754d2e8359fee1cd9dded8.tar.gz yuescript-d4b7efe3f48b40d108754d2e8359fee1cd9dded8.tar.bz2 yuescript-d4b7efe3f48b40d108754d2e8359fee1cd9dded8.zip |
Added global const declaration.
Diffstat (limited to 'doc/docs')
-rwxr-xr-x | doc/docs/doc/README.md | 11 | ||||
-rwxr-xr-x | doc/docs/zh/doc/README.md | 11 |
2 files changed, 22 insertions, 0 deletions
diff --git a/doc/docs/doc/README.md b/doc/docs/doc/README.md index dac96ee..1142fc3 100755 --- a/doc/docs/doc/README.md +++ b/doc/docs/doc/README.md | |||
@@ -1513,6 +1513,17 @@ const {:a, :b, c, d} = tb | |||
1513 | </pre> | 1513 | </pre> |
1514 | </YueDisplay> | 1514 | </YueDisplay> |
1515 | 1515 | ||
1516 | You can also declare a global variable to be `const`. | ||
1517 | |||
1518 | ```moonscript | ||
1519 | global const Constant = 123 | ||
1520 | ``` | ||
1521 | <YueDisplay> | ||
1522 | <pre> | ||
1523 | global const Constant = 123 | ||
1524 | </pre> | ||
1525 | </YueDisplay> | ||
1526 | |||
1516 | ## Literals | 1527 | ## Literals |
1517 | 1528 | ||
1518 | All of the primitive literals in Lua can be used. This applies to numbers, strings, booleans, and **nil**. | 1529 | All of the primitive literals in Lua can be used. This applies to numbers, strings, booleans, and **nil**. |
diff --git a/doc/docs/zh/doc/README.md b/doc/docs/zh/doc/README.md index 850afed..a4e76bb 100755 --- a/doc/docs/zh/doc/README.md +++ b/doc/docs/zh/doc/README.md | |||
@@ -1512,6 +1512,17 @@ const {:a, :b, c, d} = tb | |||
1512 | </pre> | 1512 | </pre> |
1513 | </YueDisplay> | 1513 | </YueDisplay> |
1514 | 1514 | ||
1515 | 你也可以声明全局变量为常量。 | ||
1516 | |||
1517 | ```moonscript | ||
1518 | global const Constant = 123 | ||
1519 | ``` | ||
1520 | <YueDisplay> | ||
1521 | <pre> | ||
1522 | global const Constant = 123 | ||
1523 | </pre> | ||
1524 | </YueDisplay> | ||
1525 | |||
1515 | ## 字面量 | 1526 | ## 字面量 |
1516 | 1527 | ||
1517 | Lua中的所有基本字面量都可以在月之脚本中使用。包括数字、字符串、布尔值和**nil**。 | 1528 | Lua中的所有基本字面量都可以在月之脚本中使用。包括数字、字符串、布尔值和**nil**。 |