Created
July 31, 2016 19:19
-
-
Save osyo-manga/ad08d62c37fc078cdac85e697a23dc17 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! s:init(value) | |
let value = a:value | |
" 初期値に基づいて関数を定義する | |
function! s:hoge() closure | |
return value + value | |
endfunction | |
function! s:bar(value) closure | |
return value + a:value | |
endfunction | |
endfunction | |
" 任意の値で初期化して関数を定義する | |
call s:init(42) | |
echo s:hoge() | |
" => 84 | |
echo s:bar(-20) | |
" => 22 | |
" 任意の値で関数を書き換える | |
call s:init(-4) | |
echo s:hoge() | |
" => -8 | |
echo s:bar(-20) | |
" => -24 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment