diff options
author | Sean Dewar <seandewar@users.noreply.github.com> | 2022-02-06 00:02:30 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-06 00:02:30 +0000 |
commit | 28d5face21748bbd7b116a1e57bffb535dba392a (patch) | |
tree | ffc38efe0a232839dc901877cdaa97a2a85f5770 /runtime/doc/eval.txt | |
parent | b17f1e6fe86ae44676647ef939b361f54d95cd4d (diff) | |
parent | 8adbba7ac38d7a0b4e1f602f6522b9403c11fc7e (diff) | |
download | rneovim-28d5face21748bbd7b116a1e57bffb535dba392a.tar.gz rneovim-28d5face21748bbd7b116a1e57bffb535dba392a.tar.bz2 rneovim-28d5face21748bbd7b116a1e57bffb535dba392a.zip |
Merge pull request #16862 from seandewar/vim-8.2.2658
vim-patch:8.2.{2658,2661,2736}: for loop over strings
Diffstat (limited to 'runtime/doc/eval.txt')
-rw-r--r-- | runtime/doc/eval.txt | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 2b79b0280f..fc788fba59 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -372,8 +372,8 @@ Changing the order of items in a list: > For loop ~ -The |:for| loop executes commands for each item in a |List| or |Blob|. -A variable is set to each item in the sequence. Example with a List: > +The |:for| loop executes commands for each item in a |List|, |String| or |Blob|. +A variable is set to each item in sequence. Example with a List: > :for item in mylist : call Doit(item) :endfor @@ -390,7 +390,7 @@ If all you want to do is modify each item in the list then the |map()| function will be a simpler method than a for loop. Just like the |:let| command, |:for| also accepts a list of variables. This -requires the argument to be a list of lists. > +requires the argument to be a List of Lists. > :for [lnum, col] in [[1, 3], [2, 8], [3, 0]] : call Doit(lnum, col) :endfor @@ -408,6 +408,12 @@ It is also possible to put remaining items in a List variable: > For a Blob one byte at a time is used. +For a String one character, including any composing characters, is used as a +String. Example: > + for c in text + echo 'This character is ' .. c + endfor + List functions ~ *E714* |