Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Parameters and what to check
Message
 
À
17/10/2007 20:08:11
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01261696
Message ID:
01261699
Vues:
31
>Let's say I have a procedure that is expecting 3 parameters, but sometimes only 2. They should all be character. Is there a standard that others use that would run through some validations, checking type, pcount, stuff like that? Want to make the project I'm working on as tight and error free as possible. Here is an example:
>
>
>******************************************************************************************************
>FUNCTION Procedure_Locked
>******************************************************************************************************
>
>	LPARAMETERS tcProcess, tcLockUnlock, tcUserID
>
>
Jay,

What I like is something like:
local lcProcess, lcLockUnlock, lcUserID

lcProcess	= iif(vartype(tcProcess) = 'C', tcProcess, {Default value}) && or alltrim(tcProcess) or upper or lower etc
* Same thing with all parameters

* Now, I use just the local variables, not the parameters
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform