Down a leafy lane or up queer street?

Tore Nilsen tore.nilsen at
Sun Apr 29 14:57:52 EDT 2018

The variabel scope can be a bit tricky. The difference between a script local variabel (declared as a local variabel outside any handlers) and a global variabel can be confusing. They act very much the same way when used within one script. The main difference being that a global variabel can be used in any script when it is declared in the same script. Both variabels retain their values between handlers and sessions as long as the application is open. To add to the confusion, temporary variabels (undeclared or declared local within a handler) are referred to as local variabels also.

For the convenience of my students I refer to variabels that are undeclared (or declared within a handler) for temporary variabels, with names starting with t-. I only refer to local variabels as local when they are declared outside of handler, and I use names starting with s-. To make sure that global variabels are easily recognised as such I start their name with g-. I use the same naming convention for arrays. I also declare all global and script local variabels at the top of my scripts. Then I am sure they will be available to all handlers in that script.


> 29. apr. 2018 kl. 20:37 skrev Richmond Mathewson via use-livecode <use-livecode at>:
> "it must be declared in all scripts that uses this variabel."
> Aha: *thanks* for that.

More information about the use-livecode mailing list