November 2018
Beginner
330 pages
7h 21m
English
Just like most other programming languages, Vim supports functions:
function AnimalGreeting(animal) echo a:animal . ' says hello!'endfunction
You can try calling the function and you'll get the following output:
:call AnimalGreeting('cat')
cat says hello!
You can see that function arguments are accessed via the a: scope.
Functions, of course, can return values:
function! AnimalGreeting(animal) return a:animal . ' says hello!'endfunction
Read now
Unlock full access