I use exit as my single point out by not including a WHILE or UNTIL. SELECT YADAYADA
LOOP READNEXT KEY ELSE EXIT Do Stuff Do Stuff REPEAT Israel, John R. wrote: > I agree completely with David. I make it a habit to have one way in and one > way out for my loops and subroutines. It makes it much easier to > enhance/debug in the future (which is what most of us spend most of our time > doing). I will not say I NEVER break this rule, but it is rare. > > John Israel > > -----Original Message----- > From: owner-u2-us...@listserver.u2ug.org > [mailto:owner-u2-us...@listserver.u2ug.org] On Behalf Of David A. Green > Sent: Friday, February 27, 2009 1:25 PM > To: u2-users@listserver.u2ug.org > Subject: RE: [U2] DO/WHILE vs IF THEN > > George, > > In my opinion you lose the elegance and readability of the LOOP construct > when you use EXIT. Code is easier to debug and enhance when Loops and > Subroutines have one entry and one exit. > > Thanks, > David A. Green > www.dagconsulting.com > (480) 813-1725 > > > -----Original Message----- > From: owner-u2-us...@listserver.u2ug.org > [mailto:owner-u2-us...@listserver.u2ug.org] On Behalf Of George Gallen > Sent: Friday, February 27, 2009 9:20 AM > To: Ardent > Subject: [U2] DO/WHILE vs IF THEN > > OK Aside from programming styles > > Is there any "functional" difference between > > WHILE expression DO and IF NOT(expression) THEN EXIT > and > UNTIL expression DO and IF expression THEN EXIT > > > First I thought that the DO/WHILE would activate as soon as > the condition occurred and drop out of a loop, but that is not > the case, the condition has to be active AND control has to be > back at the WHILE statement. > > > Example: > > 0001: CTR=0 > 0002: LOOP > 0003: CTR=CTR+1 > 0004: WHILE CTR<4 DO > 0005: PRINT CTR > 0006: CTR=CTR+1 > 0007: PRINT CTR > 0008: CTR=CTR+1 > 0009: PRINT CTR > 0010: CTR=CTR+1 > 0011: PRINT CTR > 0012: CTR=CTR+1 > 0013: PRINT CTR > 0014: CTR=CTR+1 > 0015: PRINT CTR > 0016: CTR=CTR+1 > 0017: PRINT CTR > 0018: REPEAT > 0019: STOP > 0020: END > > My first thought was that once CTR = 5, the loop would end (at LINE 12) but > it > didn't > until control was passed back to LINE 4, then it ended. > ------- > u2-users mailing list > u2-users@listserver.u2ug.org > To unsubscribe please visit http://listserver.u2ug.org/ > ------- > u2-users mailing list > u2-users@listserver.u2ug.org > To unsubscribe please visit http://listserver.u2ug.org/ > ------- > u2-users mailing list > u2-users@listserver.u2ug.org > To unsubscribe please visit http://listserver.u2ug.org/ > > -- ------------------------------------------------------------------------ Jeff Schasny - Denver, Co, USA jschasny at gmail dot com /"Come To The Dark Side, We Have Cookies."/ ------------------------------------------------------------------------ ------- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/