A little different, but this reminds me of a program I saw once with nested IFs so deep they actually indented completely off an 80x24 screen with 3 space indents. I still shudder. The CASE construct was far more readable.

Charlie Noah

On 04-20-2012 4:50 AM, Brian Leach wrote:
Many years ago, MV developers were taught not to use CASE as on the old PICK
machines they evaluated much (much) slower than the equivalent IFs -
probably a bad compiler job. So you ended up with hideous nested IF
statements that became practically unreadable.

My personal preference has always been to use CASE as it's much clearer,
especially when you start getting complex logic in-between. The only thing I
generally change is the traditional use of CASE 1 as the fall through
option, by equating OTHER to @TRUE so I can use Case OTHER.

And multi-line Ifs that are easier to follow in the debugger, especially if
you want to place a break point on either branch.

And in Will's example, it's all the same to the compiler.

As an extreme example, I once picked up some third party code written on a
McD machine. Every routine was written so it could fit on a single page of
an 80x24 terminal, including (which McD allowed) having labels in the middle
of a physical line (semi-colon delimited statements). And having to debug
that.

Brian

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Symeon Breen
Sent: 20 April 2012 09:45
To: 'U2 Users List'
Subject: Re: [U2] Case Statement with only two cases

Or perhaps there were more cases in there, and over the years they have been
deleted. The last programmer to have done a  deletion probably should have
turned it into an if - but I don't think it really matters, any professional
programmer can figure out what it means in less than a  second ;)



-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Dave Laansma
Sent: 19 April 2012 20:57
To: U2 Users List
Subject: Re: [U2] Case Statement with only two cases

Logically they are clearly the same. It just depends on what the programmer
had in mind for the future of 'A'.

Sincerely,
David Laansma
IT Manager
Hubbard Supply Co.
Direct: 810-342-7143
Office: 810-234-8681
Fax: 810-234-6142
www.hubbardsupply.com
"Delivering Products, Services and Innovative Solutions"


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Wjhonson
Sent: Thursday, April 19, 2012 3:52 PM
To: [email protected]
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
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users
-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1424 / Virus Database: 2411/4946 - Release Date: 04/19/12

_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users


_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users

_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to