Help, what am I doing wrong???

Ken Ray kray at sonsothunder.com
Mon Aug 1 00:09:22 EDT 2005


On 7/31/05 7:08 PM, "Mark Wieder" <mwieder at ahsoftware.net> wrote:
 
> A semi-related point that seems to bother nobody but me is that you
> don't have to declare loop variables (i.e., Variable Checking [aka
> explicitVars] doesn't catch them), but if you don't explicitly declare
> them as local then they become global by default, in which case you
> get namespace conflicts.

Sorry, Mark, but that's simply not true. You can check this this way:

-- Script of btn 1
on mouseUp
  repeat with x = 1 to 10
    -- do nothing
  end repeat
  answer x
end mouseUp

-- Script of btn 2
global x
on mouseUp
  answer x
end mouseUp

The first button will answer "10", the second button will answer "". x did
not become a global simply because it wasn't declared.

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com






More information about the use-livecode mailing list