Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Undefined number of parameters
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00701718
Message ID:
00701726
Vues:
16
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--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform