wrote:
> On Sep 21, 2010, at 5:02 PM, Bee wrote:
>
> > why use "let str = a:str" in a function
>
> > Looking at some functions, I have seen "let str = a:str"
>
> a:vars are read-only, read :h a:var for more details.
Thank you, I missed the read-only part when reading about a:var
The :help a:var does say "However, if a |List| or |Dictionary| is
used, you can change their contents."
I found this example function. Is {a:var} now a Dictionary?
function! Inc(var)
let {a:var} += 1
return {a:var}
endfunction
Is one better than the other?
function! Inc(var)
let var = a:var
let var += 1
return var
endfunction
-Bill
--
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:
Post a Comment