Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Single line vs multiple lines assignment
Message
From
09/02/2011 11:43:35
 
 
To
09/02/2011 10:34:57
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01499222
Message ID:
01499387
Views:
41
>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...
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform