On 21/06/14 04:34, Dr. Hawkins wrote:
On Fri, Jun 20, 2014 at 6:18 PM, Peter Haworth <p...@lcsql.com> wrote:

Wondering if anyone has an elegant way of exiting all the way out of a set
of nested repeat loops., e.g:

It's a badly needed language addition, and one of the things I want from
Fortran.

Then again, I actually used a GOTO in the software for my dissertation,
after realizing it was the rare case one was called for, and had spent
hours making parallel sets of code to avoid it.  (not to mention what I did
with a trailing preposition in that last sentence!)



This is where some sort of "get out quickly" phrase is needed.

Yesterday one of my 12 year old 'victims' was getting her feet wet with her first SWITCH statement,
and got badly bogged down, and we found that

exit switch

seemed to work a bit better than

break

the 'funny' thing is that the Dictionary (err: "Hitch Hiker's Guide to the Galaxy") says they are synonymous; but, as we linguists say 'no 2 words are ever completely synonymous'.

I suppose a GOTO statement would be really good; especially as, although Livecode scripts supposedly don't have line numbers, there are those numbers down the left-hand side :/

The only bother about those numbers is that every time one pops a bit of code into one's script they will refer to different places.

This sort of thing might not be bad:


put 1 into XX
repeat until XX>7
  do something
    put 1 into ZZ
        repeat until ZZ>7
          do something else
             put 1 into YY
                repeat until YY>7
                    ask "What colour are you socks?"
                       if it contains "purple" then
                           goto %%%
                       end if
                       add 1 to YY
                 end repeat
              add 1 to ZZ
          end repeat
       add 1 to XX
end repeat
%%%

Richmond.


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to