I think that CASE 1;Null is an old technique. If the prior conditions don't
prevail, then don't bother. Otherwise every IF statement with a THEN would
have ELSE NULL.

BTW, using IF X = 1 ELSE GOSUB 100 is also very hard to read. Sure it
compiles but source code should be readable for the programmers who have to
visually interpet these things. EVERY IF should have an THEN as it's
predominately a positive test instead of a negative test. Then use IF X # 1
THEN GOSUB 100.


----- Original Message -----
From: "Allen Egerton" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, July 25, 2007 12:48 PM
Subject: [U2] RE: Cleaner Case Statement


> Bill Brutzman asked:
>
>
> > How can this structure be cleaned-up?
> <snip>
>
> >  begin case
> >        case Ans = 'A'  ;  gosub Check.A
> >        case Ans = 'B'
> >        case Ans = '2'  ;  gosub Check.B
> >  end   case
> >
> > so that the "gosub Check.B" command is not repeated.  I have tried a few
> > alternatives without a victory.
>
>
> Dunno if it's cleaner, but this is how I would code it...
>
> Begin Case
>      Case Ans eq "A"
>          gosub Check.A:
>      Case ((Ans EQ "B") OR (Ans EQ "2"))
>          gosub Check.B:
>      Case 1
>          *  Do nothing
> End Case
>
> --
> Allen Egerton
> aegerton at pobox dot com
> -------
> 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