Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Undefined number of parameters
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00701718
Message ID:
00701726
Views:
15
You have to define max number of parameters (27) in the function and than use PCOUNT() function to get the # of actualy passed parameters.
* MAX function for positive numbers
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--
Previous
Reply
Map
View

Click here to load this message in the networking platform