Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Constants vs Locals
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00269906
Message ID:
00269956
Views:
18
>Is there any reason to use a #DEFINEd constant instead of a local var? I've seen it done, but am not aware if the rationale, particularly when trying to debug...

Bruce,

Conatants are for values that do not change, variables (of any scope) are for value that do change. For example:

A system for engineers who build bridges.
The value of Pi is required throughout the system.

Your choice is use a local var that is intitialized in each routine to 3.14 or use a #DEFINE in a header fiel to define kPI as 3.14.

The value of Pi appears in 237 routines.

The system is delivered and used. The client comes back and says, "hey, we need to use 3.1417 instead of 3.14". If you used locals you have many changes to make, if you used the ehader #DEFINE you have one change to make.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform