implicitVars [Was: Re: Best Practices in Rev development]
david at openpartnership.net
Sat Jul 14 13:48:35 CDT 2007
On 29/06/07, Jim Ault <JimAultWins at yahoo.com> wrote:
> I am a bit confused.. why would you pass a param then set it to empty?
> or establish the param and declare it as a local, as you do later?
> What is the benefit?
Finally - found a reason :)
Call by references ! I quite often in repeat loops use a call-by-reference
command to increment (or modify) some value. If you do not implicity declare
the variable you get a nasty error when the repeat loop is not executed
because something is empty.... an example may help.
There may be other examples, but take this simplified script:
on addAnA @string
put "a" after string
This does not result in an empty string, but "string"
More information about the use-livecode