implicitVars [Was: Re: Best Practices in Rev development]
David Bovill
david at openpartnership.net
Sat Jul 14 21:06:07 EDT 2007
It's just a simplified example Mark - to show the principle. the real world
script was a complex one that searched a stack and added things to an index
when they matched a certain criteria - I removed the local variable
declaration from the script and it started to fail in the cases where no
matches were found.
The principle is that if you use call-by-reference handlers inside repeat
loops they are not automatically initiated and you should implicitly declare
them either by using "local" or "put empty into..." or "put 0 into..."
On 15/07/07, Mark Smith <mark at maseurope.net> wrote:
>
> I'm curious - what's the advantage over 'put "a" after string' ?
>
> Best,
>
> Mark
>
> On 14 Jul 2007, at 19:48, David Bovill wrote:
>
> > on mouseUp
> > repeat 0
> > addAnA string
> > end repeat
> > put string
> > end mouseUp
> >
> > on addAnA @string
> > put "a" after string
> > end addAnA
> >
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
More information about the use-livecode
mailing list