Search notes:

vim script: get

" ..\run_ get

redir > get.out

let s:abc = ['foo', 'bar', 'baz']

for i in range (0, 3)
  echo i . ': ' . get(s:abc, i)
endfor
" 0: foo
" 1: bar
" 2: baz
" 3: 0

echo ' '
echo "With default argument"
echo ' '

for i in range (0, 3)
  echo i . ': ' . get(s:abc, i, 'def')
endfor
" 0: foo
" 1: bar
" 2: baz
" 3: def


" get to access values of variables whose name is
" stored in another variable

let g:SomeVar    = 'One'
let g:AnotherVar = 'Two'

let s:VarName = 'SomeVar'
echo get(g:, s:VarName)
" One

let s:VarName = 'AnotherVar'
echo get(g:, s:VarName)
" Two

redir END
q
Github repository about-vim, path: /vimscript/functions/get.vim

See also

Vim: built in functions
VIM script

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758184337, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/vim/script/vimscript/functions/get(83): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78