Define "sane"

Murphy's rules of combat, #18

"If it's stupid but works, then it isn't stupid."
(http://www.heavymetalpro.com/MurphysRules.htm)

Most of the posts had workable exits, many more readable than others.  This
to me is not quite as readable or straight forward as others, when you start
adding in more code it would become more difficult to understand than other
solutions.

IMHO

        *=aee=*


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Ken Wallis
Sent: Sunday, January 16, 2005 00:06
To: [email protected]
Subject: RE: [U2] How to "exit" out mulitple loops?


Clifton Oliver wrote

> In that case, a determinate structure like FOR-NEXT is inappropriate.
> Use the indeterminate LOOP UNTIL REPEAT with the condition
> check in the UNTIL clause.

Twenty-something answers to this simple question and only one sane one?

FOR T = 1 TO 10
   CONDITION = 0
   Q = 1
   LOOP
      X = 1
      LOOP
         * do stuff that might set CONDITION
      UNTIL X = 9 OR CONDITION
         X += 1
      REPEAT
   UNTIL Q = 6 OR CONDITION
      Q += 1
   REPEAT
NEXT T

Cheers,

Ken

> George Gallen wrote:
> > For instance.
> >
> > FOR T=1 TO 10
> >     FOR Q=1 TO 6
> >         FOR X=1 TO 9
> >              IF CONDITION THEN EXIT ; EXIT
> >                             OR
> >              IF CONDITION THEN CONTINUE T
> >         NEXT X
> >     NEXT Q
> > NEXT T
> >
> > So the point being if a condition occurs, I want to stop
> >    the x and q loops entirely, and continue on with the
> >    next t iteration.
> >
> > This is with UV10
> >
> > yes, I could use a line label, but then I'd almost be
> > forced into a goto. Please no wars on this
> > or anything that takes more than 5 additional lines
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to