[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 PCOUNT()
 Determine the position of the last actual parameter passed
------------------------------------------------------------------------------
 Syntax

     PCOUNT() --> nLastArgumentPos

 Returns

     PCOUNT() returns, as an integer numeric value, the position of the last
     argument passed.  If no arguments are passed, PCOUNT() returns zero.

 Description

     PCOUNT() reports the position of the last argument in the list of
     arguments passed when a procedure or user-defined function is invoked.
     This information is useful when determining whether arguments were left
     off the end of the argument list.  Arguments skipped in the middle of
     the list are still included in the value returned.

     To determine if a parameter did not receive a value, test it for NIL.
     Skipped parameters are uninitialized and, therefore, return NIL when
     accessed.  Another method is to test parameters with the VALTYPE()
     function.  This can establish whether the argument was passed and
     enforce the correct type at the same time.  If a parameter was not
     supplied, a default value can be assigned.

     For more information on passing parameters, refer to the "Basic
     Concepts" chapter in the Programming and Utilities Guide.

 Examples

     .  This example is a user-defined function that opens a database
        file and uses PCOUNT() to determine whether the calling procedure
        passed the name of the database file to be opened.  If the name was
        not passed, OpenFile() asks for the name:

        FUNCTION OpenFile( cFile )
           IF PCOUNT() = 0
              ACCEPT "File to use: " TO cFile
           ENDIF
           USE (cFile)
           RETURN (NETERR())

 Files   Library is CLIPPER.LIB.


See Also: DO* FUNCTION PARAMETERS PROCEDURE VALTYPE()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson