exit repeat and nested repeats

Mark Schonewille m.schonewille at economy-x-talk.com
Thu Aug 1 16:41:29 EDT 2013


Hi Andrew,

You can use a variable if you want to exit all repeat loops:

          repeat for each key sKey in sData
             repeat for each key sKey2 in sData[sKey]
                put true into myExitAll
                exit repeat
             end repeat
             if myExitAll then
               exit repeat
             end if
          end repeat

Or use a separate handler:

on twoRepeatLoops
     repeat for each key sKey in sData
         repeat for each key sKey2 in sData[sKey]
            exit twoRepeatLoops
         end repeat
     end repeat
end twoRepeatLoops

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Use Color Converter to convert CMYK, RGB, RAL, XYZ, H.Lab and other 
colour spaces. http://www.color-converter.com

Buy my new book "Programming LiveCode for the Real Beginner" 
http://qery.us/3fi

Fill out this survey please
http://livecodebeginner.economy-x-talk.com/survey/

On 8/1/2013 22:22, Andrew Kluthe wrote:
> How does exit repeat handle nested repeats? Does it exit the parent repeat
> if called from a child repeat in two repeats that are nested in a handler?
>
>           repeat for each key sKey in sData
>              repeat for each key sKey2 in sData[sKey]
>                 exit repeat
>              end repeat
>           end repeat
>
>
>




More information about the use-livecode mailing list