The case statement can be faster if you put the condition with the most 
occurrences first. As soon as the 'true' condition is met, the program exits 
the case statement.  The if-then-else construct took longer to evaluate.  When 
processors were slow, there were gains to be had.

Richard Sammartino
----- Original Message -----
From: "Wjhonson" <wjhon...@aol.com>
To: u2-users@listserver.u2ug.org
Sent: Thursday, April 19, 2012 3:52:21 PM
Subject: [U2] Case Statement with only two cases


Is there a point in code like this

BEGIN CASE
   CASE A = "TEST"; GOSUB DO.SOMETHING
   CASE 1; GOSUB DO.SOMETHING.ELSE
END CASE

versus this

IF A = "TEST" THEN GOSUB DO.SOMETHING ELSE GOSUB DO.SOMETHING.ELSE

Personally I see no advantage in making this a  CASE

Does the rest of the *Universe* agree with me?
_______________________________________________
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

Reply via email to