let i = a:start
let curr_line = 0
while i <= a:end
        if a:step <= 0
            echo "Error: step cannot <=0."
            break
        endif
call append(curr_line, i)
let i += a:step
let curr_line += 1
endwhile
endfunction
when I call this function, I type this:
:echo InsertNumber(8,10,1)
8
9
10
1) How can I give arguement "step" a default value(eg: 1) when define the function?
like a C function:
void C_func(int a, int b_have_default_val = 1)
{
;
}
2)
I want to print number like this, how to do it?
08
09
10
function InsertNumber(start, end,...) " step,is_column_first_0_padding,radix(b,d,o,x)
        let l:i = a:start
        let l:curr_line = 0
    if a:0 == 0          " a:0 extra argument numbers
        let l:step = 1
    else   
        let l:step = a:1 " the first extra argument
    endif
    if a:0 == 2
        let l:is_padding = 0
    else
        let l:is_padding = 1 "default padding
    endif
    if a:0 == 3
        let l:radix = a:3
    else
        let l:radix = ""
    endif
    if l:radix == "b"
    elseif l:radix == "o"
    elseif l:radix == "x"
    else
        let l:width = float2nr(trunc(log10(a:end))) + 1
        let l:format = '%0'.l:width.'d'
    endif
    while l:i <= a:end
        if l:step <= 0
            echo "Error: step cannot <= 0."
            break
        endif
        if l:is_padding == 1
                    call append(curr_line, printf(l:format, l:i))
            else
            call append(curr_line, l:i)
        endif
        let l:i += l:step
                let l:curr_line += 1
        endwhile
endfunction
function InsertNumber(start, end,...) " step, radix(d,o,x), is_padding
	let l:i = a:start
	let l:curr_line = 0
    let l:step = get(a:000,0,1)
    "echo l:step
    if l:step <= 0
        echo "Error: step cannot <= 0."
        return -1 
    endif
    let l:radix = get(a:000,1,'d')
    "echo l:radix
    if a:0 == 3
        let l:is_padding = 0
    else
        let l:is_padding = 1 "default padding
    endif
    if l:radix == "o"
        "let l:width = strlen(printf('%o',a:end))
        let l:width = len(a:end)
let l:format = '%0'.l:width.'o'
    elseif l:radix == "x"
"let l:width = strlen(printf('%x',a:end))
        let l:width = len(a:end)
let l:format = '%0'.l:width.'x'
    else
        "let l:width = float2nr(trunc(log10(a:end))) + 1
"let l:width = strlen(printf('%d',a:end))
        let l:width = len(a:end)
        let l:format = '%0'.l:width.'d'
    endif
    
    while l:i <= a:end
        if l:is_padding == 1
    		call append(l:curr_line, printf(l:format, l:i))
        else
            call append(l:curr_line, l:i)
        endif
        let l:i += l:step
    	let l:curr_line += 1
    endwhile
endfunction