From: Hans-Bernhard B. <br...@ph...> - 2004-04-25 19:50:32
|
On Sat, 24 Apr 2004, Petr Mikulik wrote: > Currently, inside bla.gp called like > > call "bla.gp" one two 3 4 > > it is not possible to determine how many parameters were passed into it. > The only way seems to be a global variable like > > params=4; call "bla.gp" one two 3 4 > > and to use > > if (defined(params) && params==4) ... Why that complicated? What's wrong with making the number of parameters the first parameter, i.e. call "bla.gp" 4 one two 3 4 ? OTOH, what you really need would be a "was parameter number <n> passed in by the caller?" kind of test, i.e. the equivalent of the Bourne shell standard phrase if [ "x$5" != "x" ] I.e. a mix between the 'defined' and 'valid' operators, but for 'call' parameters instead of user-defined variables or data file column values, respectively. Arguably valid() itself might be the one that should be offering this. > I propose to add "variable" $# which will be set to number of available > $0, $1, ... Please keep in mind that '#' is our comment character. -- Hans-Bernhard Broeker (br...@ph...) Even if all the snow were burnt, ashes would remain. |