local and do <commands> - what NOT to do
-hh
hh at livecode.org
Thu Feb 18 07:45:20 EST 2016
Mark Wadd. wrote:
> > [-hh] wrote:
> > local a1=1, a2=false
> > -- local a[1]=1, a[2]=false #<-- currently not allowed
> >
> > For such default-constructs variable names and using "do"
> > are really helpful.
>
> Although you can do the above as:
> local a -- only needed if in strict compilation mode
> put 1 into a[1]
> put false into a[2]
I meant local *script* variables, outside of handlers,
I seldom use local declarations within handlers.
The possibility of setting default values is an important
tool for me.
For example in a button script that uses a certain variable
in mouseEnter, mouseDown, menuPick and ...
Where to set the default for an array entry if one wishes
to use also "send <message>" to the button? In each and
every handler?
(These local variable declarations in the top lines of my
scripts act for me also like the header of a HTML-page.
Nearly always one knows roughly alone from that what's
following.)
=======
Hermann
More information about the use-livecode
mailing list