# Re: [U2] EXIT ; EXIT inside a loop

```Will,

Two things.```
```
First, good programming practice tells you to define the abort logic once.
Sure G # H is simple, but this is just an example it could get quite
complex.

Second, There are statements before and after the abort situation, and your
code doesn't handle it.

David A. Green
(480) 813-1725
DAG Consulting

-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
Sent: Thursday, April 19, 2012 4:33 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] EXIT ; EXIT inside a loop

You don't need a DONE.FLAG
A1 = 0
LOOP UNTIL (G=H) OR (A1=X) DO
A1 += 1; A2 = 0
LOOP UNTIL (G=H) OR (A2=Y) DO
A2 += 1
You're in a maze of twisty little passages all alike
REPEAT
REPEAT

-----Original Message-----
From: David A. Green <dgr...@dagconsulting.com>
To: 'U2 Users List' <u2-users@listserver.u2ug.org>
Sent: Thu, Apr 19, 2012 4:28 pm
Subject: Re: [U2] EXIT ; EXIT inside a loop

I was referring to the outer loops.
David A. Green
480) 813-1725
AG Consulting

----Original Message-----
rom: u2-users-boun...@listserver.u2ug.org
mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
ent: Thursday, April 19, 2012 3:40 PM
o: u2-users@listserver.u2ug.org
ubject: Re: [U2] EXIT ; EXIT inside a loop

I have no idea what you mean, they both "abort" if you want to call it hat.
They both exit the loop on the exact same condition, at the exact same
oment.
I don't see the distinction you're trying to draw

-----Original Message-----
rom: David A. Green <dgr...@dagconsulting.com>
o: 'U2 Users List' <u2-users@listserver.u2ug.org>
ent: Thu, Apr 19, 2012 3:35 pm
ubject: Re: [U2] EXIT ; EXIT inside a loop

ill,
his type of logic is a common practice when you can have an Abort situation
the middle of processing data.
ou are correct in your examples they are the same.  But that is not the int
here.  You must remember that we are in two FOR..NEXT loops with ssible
1000s or 10,000s loops.  If we are processing and suddenly a esource oes
off-line, then we need to abort the process.  My construct is  great ay of
handling the abort.
our way doesn't work because the values of G or H can change if you just ep
looping on your FOR...NEXT loops.  The original poster wanted to EXIT t, and
stop processing.
avid A. Green
80) 813-1725
G Consulting
----Original Message-----
om: u2-users-boun...@listserver.u2ug.org
ailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
nt: Thursday, April 19, 2012 3:24 PM
: u2-users@listserver.u2ug.org
bject: Re: [U2] EXIT ; EXIT inside a loop
Loop
until done.flag do
repeat
is the same as
Loop
until (a=b) do
repeat
You don't need a done.flag in this case -----Original Message-----
om: David A. Green <dgr...@dagconsulting.com>
: 'U2 Users List' <u2-users@listserver.u2ug.org>
nt: Thu, Apr 19, 2012 3:21 pm
bject: Re: [U2] EXIT ; EXIT inside a loop ill, e DONE.FLAG allows the
program to gracefully exit out without having to go u frivolous loops.
vid A. Green
0) 813-1725
Consulting
---Original Message-----
m: u2-users-boun...@listserver.u2ug.org
ailto:u2-users-boun...@listserver.u2ug.org]
Behalf Of Wjhonson
t: Thursday, April 19, 2012 3:18 PM
u2-users@listserver.u2ug.org
ject: Re: [U2] EXIT ; EXIT inside a loop  You don't need a DONE.FLAG at all
ust loop until the criteria is hit
______________________________________________
Users mailing list
us...@listserver.u2ug.org
p://listserver.u2ug.org/mailman/listinfo/u2-users
______________________________________________
-Users mailing list
-us...@listserver.u2ug.org
tp://listserver.u2ug.org/mailman/listinfo/u2-users
______________________________________________
-Users mailing list
-us...@listserver.u2ug.org
tp://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
2-Users mailing list
2-us...@listserver.u2ug.org
ttp://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
2-Users mailing list
2-us...@listserver.u2ug.org
ttp://listserver.u2ug.org/mailman/listinfo/u2-users

_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
```