Mercurial > vim
diff runtime/doc/vim9.txt @ 23827:7e0d8f1cae7d v8.2.2455
patch 8.2.2455: Vim9: key type for literal dict and indexing is inconsistent
Commit: https://github.com/vim/vim/commit/2e5910bfbb05957c10c9c69756dfa342557e9a8b
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Feb 3 17:41:24 2021 +0100
patch 8.2.2455: Vim9: key type for literal dict and indexing is inconsistent
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 03 Feb 2021 17:45:06 +0100 |
parents | 34b4eb3a8458 |
children | 5b37a0bf7e3a |
line wrap: on
line diff
--- a/runtime/doc/vim9.txt +++ b/runtime/doc/vim9.txt @@ -548,6 +548,12 @@ In case the key needs to be an expressio 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 ~