[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
+---------------------------------+
|          PARAMETERS()           |
+---------------------------------+
PARAMETERS()

-----------------------------------
Returns number of parameters that were passed to most recently called
procedure.
Return value - Numeric
-----------------------------------

This function is useful in situations where a variable number of
parameters are being passed to a procedure or a UDF.

+---------------------------------+
|         Program Example         |
+---------------------------------+
Executing this program returns:  Average value is  18.75

SET TALK OFF
val1 = 10
val2 = 20
val3 = 30
val4 = 15
m_min = getavg(val1, val2, val3, val4)
? 'Average value is '
?? m_min

* This UDF allows up to 9 parameters to be passed.
* It uses the PARAMETER() function to determine how many
* were passed and returns the average value.

FUNCTION getavg
PARAMETER para1,para2,para3,para4,para5,para6,para7,para8,para9
IF PARAMETERS() = 0
   RETURN 0
ENDIF
mresult = 0
FOR mcount = 1 to PARAMETERS()
    mcompare = 'para' +(STR(mcount,1))
    mresult = mresult + EVAL(mcompare)
ENDFOR
mresult = mresult / (mcount - 1)
RETURN mresult

-----------------------------------

See Also:  FUNCTION, PARAMETERS, PROCEDURE, SET UDFPARMS, USER-DEFINED
FUNCTIONS (UDFs)

-----------------------------------

See Also: FUNCTION PARAMETERS PROCEDURE SET UDFPARMS
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson