Verbosity and Lines of code

Jim Lambert jiml at netrin.com
Sat Jul 1 01:59:18 CEST 2017


> RICHARDG  wrote:
> 
> This would allow us to exit a specific loop when loops are nested.
> 
> I can't recall the specifics of his proposed syntax, but I remember
> being impressed by how natural it seemed. Maybe it was along the lines of:
> 
>   repeat with i = 1 to tSomething named "MySomethingLoop"
>     repeat with j = 1 to tSomethingElse named "MyOtherLoop"
>       DoSomethingWith i,j
>       exit "MySomethingLoop"
>     end repeat
>   end repeat


If we can tolerate 2 extra lines of code we can do nested exits this way:

   repeat with i = 1 to tSomething
      if exitMe = true then exit repeat
      repeat with j = 1 to tSomethingElse
         if exitMe = true then exit repeat
         DoSomethingWith i,j
         put true into exitMe
      end repeat
   end repeat

Jim Lambert



More information about the use-livecode mailing list