You have to define max number of parameters (27) in the function and than use PCOUNT() function to get the # of actualy passed parameters.
LPARMETERS p1, p2, p3, ..., p27
LOCAL lnMax, lnVal
lnMax = 0
FOR i=1 TO PCOUNT()
STORE EVAL("p" + TRANSFORM(i)) TO lnVal
IF lnVal > lnMax
lnMax = lnVal
ENDIF
ENDFOR
RETURN lnMax
>Hi all,
>
>How can I write a function (as the min or max functions) with undefined number of parameters?
>
>Thanks for any help
--sb--