mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
runtime(doc): Update help for the items() function
closes: #18021 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
20a159b557
commit
308a3130be
@@ -1,4 +1,4 @@
|
||||
*builtin.txt* For Vim version 9.1. Last change: 2025 Aug 12
|
||||
*builtin.txt* For Vim version 9.1. Last change: 2025 Aug 17
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -344,7 +344,7 @@ isinf({expr}) Number determine if {expr} is infinity value
|
||||
(positive or negative)
|
||||
islocked({expr}) Number |TRUE| if {expr} is locked
|
||||
isnan({expr}) Number |TRUE| if {expr} is NaN
|
||||
items({dict}) List key-value pairs in {dict}
|
||||
items({expr}) List key-value pairs in {expr}
|
||||
job_getchannel({job}) Channel get the channel handle for {job}
|
||||
job_info([{job}]) Dict get information about {job}
|
||||
job_setoptions({job}, {options}) none set options for {job}
|
||||
@@ -6310,20 +6310,24 @@ isnan({expr}) *isnan()*
|
||||
Return type: |Number|
|
||||
|
||||
|
||||
items({dict}) *items()*
|
||||
Return a |List| with all the key-value pairs of {dict}. Each
|
||||
|List| item is a list with two items: the key of a {dict}
|
||||
entry and the value of this entry. The |List| is in arbitrary
|
||||
order. Also see |keys()| and |values()|.
|
||||
Example: >
|
||||
for [key, value] in items(mydict)
|
||||
echo key .. ': ' .. value
|
||||
endfor
|
||||
<
|
||||
A |List|, a |Tuple| or a |String| argument is also supported.
|
||||
In these cases, items() returns a List with the index and the
|
||||
value at the index.
|
||||
items({expr}) *items()*
|
||||
Return a |List| with all the key/index and value pairs of {expr}.
|
||||
Each |List| item is a list with two items:
|
||||
- for a |Dict|: the key and the value
|
||||
- for a |List|, |Tuple| or |String|: the index and the value
|
||||
The |List| is in arbitrary order.
|
||||
|
||||
Also see |keys()| and |values()|.
|
||||
|
||||
Examples: >
|
||||
let mydict = #{a: 'red', b: 'blue'}
|
||||
for [key, value] in items(mydict)
|
||||
echo $"{key} = {value}"
|
||||
endfor
|
||||
echo items([1, 2, 3])
|
||||
echo items(('a', 'b', 'c'))
|
||||
echo items("foobar")
|
||||
<
|
||||
Can also be used as a |method|: >
|
||||
mydict->items()
|
||||
<
|
||||
|
@@ -1,4 +1,4 @@
|
||||
*usr_41.txt* For Vim version 9.1. Last change: 2025 Aug 10
|
||||
*usr_41.txt* For Vim version 9.1. Last change: 2025 Aug 17
|
||||
|
||||
VIM USER MANUAL - by Bram Moolenaar
|
||||
|
||||
@@ -806,6 +806,7 @@ String manipulation: *string-functions*
|
||||
ngettext() lookup single/plural message translation
|
||||
str2blob() convert a list of strings into a blob
|
||||
blob2str() convert a blob into a list of strings
|
||||
items() get List of List index-value pairs
|
||||
|
||||
List manipulation: *list-functions*
|
||||
get() get an item without error for wrong index
|
||||
|
Reference in New Issue
Block a user