Constant command
J. Landman Gay
jacque at hyperactivesw.com
Thu Oct 14 15:26:04 EDT 2010
On 10/14/10 11:28 AM, DunbarX at aol.com wrote:
> About the constant command that Phil used in his process gadget. What does
> it do that a variable does not? I see it cannot be altered in the same
> handler, and I see that it can overRide a built-in constant, which might be
> useful. Anyone ever come up with a compelling reason to use such a thing?
In Phil's example a variable would work just as well. I use constants
more often at the top of scripts.
In the case of scripts, local variables have to be set at some point
before they will have a value, so I use those for things that are
specific to the user setup (file paths I'll need repeatedly, for
example.) Constant values are permanent until you change the script, so
they're good for things that rarely change, like version numbers, lists
of related objects you need to loop through often, and other
script-related uses.
I almost never use constants inside a handler, but that's just personal
style.
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list