Question

Is there a way in TCL to get the number of parameters that procedure accepts? For example we have procedure:

proc func {a} {
    puts $a
}

I need a way to put in variable the number of parameters that func procedure accepts.

Était-ce utile?

La solution

You could maybe try something like:

info args func

This will get the arguments that func require.

Then you can use it to get the number of arguments:

set num [llength [info args func]]

In your case, $num will be 1.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top