diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-02-03 17:41:24 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-02-03 17:41:24 +0100 |
commit | 2e5910bfbb05957c10c9c69756dfa342557e9a8b (patch) | |
tree | c70cb2b5240cb3f8465cb14773a11c25622e9a41 /runtime | |
parent | 91478ae49a1b2dc1de63821db731a343e855dcc0 (diff) | |
download | vim-git-2e5910bfbb05957c10c9c69756dfa342557e9a8b.tar.gz |
patch 8.2.2455: Vim9: key type for literal dict and indexing is inconsistentv8.2.2455
Problem: Vim9: key type that can be used for literal dict and indexing is
inconsistent.
Solution: Allow using number and bool as key for a literal dict. (#7771)
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/vim9.txt | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/runtime/doc/vim9.txt b/runtime/doc/vim9.txt index 7246ff87a..220a19ba8 100644 --- a/runtime/doc/vim9.txt +++ b/runtime/doc/vim9.txt @@ -548,6 +548,12 @@ In case the key needs to be an expression, square brackets can be used, just like in JavaScript: > var dict = {["key" .. nr]: value} +The key type can be string, number, bool or float. Other types result in an +error. A number can be given with and without the []: > + var dict = {123: 'without', [456]: 'with'} + echo dict + {'456': 'with', '123': 'without'} + No :xit, :t, :append, :change or :insert ~ |