Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Single line vs multiple lines assignment
Message
De
09/02/2011 11:43:35
 
 
À
09/02/2011 10:34:57
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01499222
Message ID:
01499387
Vues:
42
>About your last statement (this allows for additional commenting on the line to indicate why multiple variables all have the same value) -- you can comment each line of a multiple line statement if you wish

Yes -- quite aware of the ability to span multiple lines via the ; for continuation. So you can comment each -- but my main thought is why have multiple variables with the same value? Some how this seems to be bad design and possibly confusing as to why. If a value is to be retained like an original, I would do the following:
LOCAL lcWorkingValue, lcOriginalValue
STORE "" TO lcWorkingValue, lcOriginalValue

&&  Some code here...

lcWorkingValue = mytable.myfield + " " + lcSomeOtherString
lcOriginalValue = lcWorkingValue

&&  Now change the lcOriginalValue in the code...
&&  Some code here...
&&  Now you can compare to the original value if needed...
I don't see the need to have a multitude of variables with the same value -- the STORE command takes a single value and assigns to a list of variables. This seems to be useful at initialization and not later in code... The readability is an choice of the user as to which is "better":

STORE "SomeValue" TO lcMyVariable

Or

lcMyVariable = "SomeValue"

I find either to be "readable" -- the second form is easier to type...
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform