Wednesday, September 22, 2010

Re: why use "let str = a:str" in a function

On Sep 22, 10:18 am, Ben Fritz <fritzophre...@gmail.com> wrote:
> On Sep 22, 11:44 am, Bee <200...@calcentral.com> wrote:
> > Is it possible to increment all items in a dict without looping?
>
> You can use the map() function, which probably does technically use a
> loop but does so in the underlying C code, so it will be faster than
> an equivalent vimscript :for or :while loop.

Great! Thank you.

This works to increment both values

let my_dict = { 'first' : 1 , 'second' : 9 }
echo map(my_dict, 'v:val + 1')

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: