Clearing local variables

Peter M. Brigham pmbrig at gmail.com
Sat Apr 30 09:31:59 EDT 2016


I generally do the same thing with nested repeats, but my comments are different:

On Apr 30, 2016, at 2:13 AM, Kay C Lan wrote:

> On Sat, Apr 30, 2016 at 9:19 AM, Dr. Hawkins <dochawk at gmail.com> wrote:
> 
>> Exiting an outer loop from within an inner  takes
>> contortions, but figuring out which end is attached to which if or repeat
>> is time consuming.
>> 
>> I know you've figured it out but for any noobs reading this and scratching
> their heads here is how I do it - I'm sure the experts will show us
> something cleaner and simpler.
> 
> Firstly, as Alex said, when ever I type in a repeat, if, or switch I use
> comments to tag the beginning, middle and end so I spend less time lost in
> my scripts - I still get lost ;-(
> 
> I then just use 'tExitCheck' a numerical value to test to see which level
> to exit out to; 0 = exit out of all repeat loops. In the message box:

put 0 into tCounter
repeat with a = 1 to 10
 repeat with b = 1 to 10
   repeat with c = 1 to 10
     repeat with d = 1 to 10
       repeat with e = 1 to 10
         add 1 to tCounter
         -- do stuff with variables here
       end repeat  -- e = 1 to 10
       -- more processing
     end repeat  -- d = 1 to 10
     -- more processing
   end repeat  -- c = 1 to 10
   -- more processing
 end repeat  -- b = 1 to 10
 -- more processing
end repeat  -- a = 1 to 10

-- Peter

Peter M. Brigham
pmbrig at gmail.com



More information about the use-livecode mailing list