Shouldn't there be a 

IF OPERATION = LAST.OPERATION THEN EXIT

in there after the ON GOSUB?

;)

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Trey Miller
Sent: Sunday, December 02, 2007 17:43
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] Deep and long indentations vs multiple exit points


This typically sticks in the craw of those who feel ON GOSUB is anathema:

ERROR = 0
OPERATION = 0
*
LOOP
BEGIN CASE
  CASE ERROR ; EXIT
  CASE 1
    OPERATION += 1
    ON OPERATION GOSUB 1000, 2000, 3000, 4000, 5000, 6000
END CASE 
REPEAT

Personally, I feel alphanumeric subroutine names are anathema; ON/GOSUB is
merely an interesting stylistic decision.

Harold (Trey) Miller
Ph: (763)-300-8703

MaverickSoft, Inc.
16430 Birch Briar Trail
Plymouth, Minnesota 55447 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Keith Johnson
(DSLWN)
Sent: Sunday, December 02, 2007 5:59 PM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] Deep and long indentations vs multiple exit points

Dave Barret gave this code as an example:

        GOSUB OPERATION.1
        IF (NOT(ERROR)) THEN
          GOSUB OPERATION.2
          IF (NOT(ERROR)) THEN
            GOSUB OPERATION.3
            IF (NOT(ERROR)) THEN
              GOSUB OPEARTION.4
            END
          END
        END

What about this version?

        GOSUB OPERATION.1
        IF ERROR ELSE GOSUB OPERATION.2
        IF ERROR ELSE GOSUB OPERATION.4
        IF ERROR ELSE GOSUB OPERATION.5

or, more acceptably:

        GOSUB OPERATION.1
        IF GOOD THEN GOSUB OPERATION.2
        IF GOOD THEN GOSUB OPERATION.4
        IF GOOD THEN GOSUB OPERATION.5

Which I personally find far more readable than the indented code.

Regards, Keith "De gustibus non est disputandum" Johnson
-------
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/

Reply via email to