Newbie... Strict Compilation mode

Jim Bufalini jim at visitrieve.com
Sun May 10 11:13:53 EDT 2009


Graham Samuel wrote:

> As an aside, I noticed that if I start a repeat statement with
> something like:
> 
>   repeat with i = 1 to 20
> 
> even with ExplicitVars on, the local variable "i" does not have to be
> declared. I could not find an explanation of this in the docs, but
> perhaps I didn't look hard enough. I admit I find this useful, but
> then I am a convert as explained.

This is also true for:

Function myFunction pListOfLinesParam
 if pListOfLinesParam <> empty then
  repeat for each line tLine in pListOfLinesParam
   ...
  end repeat
 end if
 return tLine
end myFunction

Neither tLine or pListOfLinesParam needs to be declared even if
expicitVariables is on. And, pListOfLinesParam will return empty (and not
its own var name) if nothing is passed. I've never seen it documented
either, but I "think" tLine is considered a "param" of the repeat and
treated the same as a param of the function, which is that it is considered
declared (there is an some official name for this I think). Just a guess.
Both of these I also find useful and would prefer it not change. ;-)

Aloha from Hawaii,

Jim Bufalini 




More information about the use-livecode mailing list