The if...end else...end structure is more difficult for humans to read.  Of
course, this example is trivial.  The "case" structure is 1000 times better
suited to modelling business logic, especially as decisions get to be more
complex.  

Kevin King once wrote something like...Bill...you do not "hate"
if-statements, you merely "eschew" them.

--Bill

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Kevin King
Sent: Wednesday, July 25, 2007 12:17 PM
To: [email protected]
Subject: Re: [U2] [u2] : Cleaner Case Statement


On 7/25/07, Brutzman, Bill <[EMAIL PROTECTED]> wrote:
>
> How can this structure be cleaned-up?
>
>   begin case
>         case Ans = 'A'  ;  gosub Check.A
>         case Ans = 'B'  ;  gosub Check.B
>         case Ans = '2'  ;  gosub Check.B
>   end   case
>

If this is all you need, why not:

IF (Ans = 'A') THEN
  GOSUB Check.A
END ELSE
  GOSUB Check.B
END

Or is your example a simplification?
-Kevin
http://www.PrecisOnline.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