summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-11-30 16:14:49 +0000
committerBram Moolenaar <Bram@vim.org>2021-11-30 16:14:49 +0000
commitab36e6ae7b87b0295fb19270e4339a734875c6b1 (patch)
treef049630a28f6c7967eafd5220f43a7ff23b79123 /runtime
parent53ba95e4f0a82f6dab1791bb01f6cddc9b3f61b3 (diff)
downloadvim-git-ab36e6ae7b87b0295fb19270e4339a734875c6b1.tar.gz
patch 8.2.3704: Vim9: cannot use a list declaration in a :def functionv8.2.3704
Problem: Vim9: cannot use a list declaration in a :def function. Solution: Make it work.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/vim9.txt9
1 files changed, 4 insertions, 5 deletions
diff --git a/runtime/doc/vim9.txt b/runtime/doc/vim9.txt
index 1782f179a..dc39559c0 100644
--- a/runtime/doc/vim9.txt
+++ b/runtime/doc/vim9.txt
@@ -420,12 +420,11 @@ similar to how a function argument can be ignored: >
To ignore any remaining items: >
[a, b; _] = longList
-< *E1092*
Declaring more than one variable at a time, using the unpack notation, is
-currently not supported: >
- var [v1, v2] = GetValues() # Error!
-That is because the type needs to be inferred from the list item type, which
-isn't that easy.
+possible. Each variable can have a type or infer it from the value: >
+ var [v1: number, v2] = GetValues()
+Use this only when there is a list with values, declaring one variable per
+line is much easier to read and change later.
Constants ~