/** AWK~plus - Variable argument.
 */
BEGIN {
    variable
    print "."
}
# 可変長引数
function variable() {
    # パラメータの有無は、'in'または'length'で可能.
    # Parameter existence check can be done with　'in'or'length'.
    print "   .Variable argument."
    function varg1(v: int*): int {
        if (0 in v) assertEquals(v[0], v.length)
        return (0 in v) ? v[0]: -1
    }
    function varg2(a: String, v: int*): int {
        if (0 in v) assertEquals(v[0], v.length)
        return (0 in v) ? v[0]: -1
    }
    print "\t.varg1()\t", varg1()
    print "\t.varg1(1)\t", varg1(1)
    print "\t.varg1(2,1)\t", varg1(2, 1)
    print "\t.varg2('a')\t", varg2("a")
    print "\t.varg2('b',1)\t", varg2("b", 1)
    print "\t.varg2('c',2,3)\t", varg2("c", 2, 3)
}