xHarbour Reference Documentation > Function Reference |
Returns the number of passed parameters.
PCount() --> nParamCount
The function returns a numeric value indicating the number of parameters passed to a function, procedure or method.
PCount() reports the number of parameters passed to a called function, procedure or method. Note that if parameters are omitted in a call, they are initialized with NIL in the called routine. PCount() reports the last parameter passed to a called routine (see the example).
See also: | FUNCTION, HB_ArgC(), PValue(), PROCEDURE, Valtype() |
Category: | Debug functions , Environment functions |
Source: | vm\pcount.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example shows the result of PCount() when a function is // called with different numbers of parameters. Omitted parameters // are implicitely passed as NIL values. PROCEDURE Main ? Test() // result: 0 ? Test( "A" ) // result: 1 ? Test( NIL ) // result: 1 ? Test( "A", "B" ) // result: 2 ? Test( "A", ) // result: 2 ? Test( "A", NIL ) // result: 2 ? Test( , "B" ) // result: 2 ? Test( , ) // result: 2 ? Test( "A", "B", "C" ) // result: 3 ? Test( "A", , "C" ) // result: 3 ? Test( , , "C" ) // result: 3 ? Test( , , NIL ) // result: 3 ? Test( , , ) // result: 3 RETURN FUNCTION Test RETURN PCount()
http://www.xHarbour.com