Skip to content

Instantly share code, notes, and snippets.

@kaneshin
Created October 3, 2011 11:38
Show Gist options
  • Save kaneshin/1258933 to your computer and use it in GitHub Desktop.
Save kaneshin/1258933 to your computer and use it in GitHub Desktop.
" Factorial - vim
command! -nargs=1 Factorial :echo s:factorial(<f-args>)
function! s:factorial(n)
if a:n <= 1
return 1
else
return a:n * s:factorial(a:n - 1)
endif
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment