Bob Cozzi wrote:
> The Select/When is a fine choice, and with the new elseif using IF and
> ELSEIF together are just a cool, I think.
>
> But what I wish the SELECT/WHEN did, was to allow a C-language-like
> SWITCH/CASE compatibility, like this:
>
>   SELECT  ErrorFlag
>   When    0
>   ...do this...
>   When    1
>   ...do that...
>   When    3
>   ...do the other thing..
>   endSel
>
> Oh, yeah, and I wish the ENDSL was spelled ENDSEL.
>
> Bob

No argument there.  When the SELECT statement was being designed,
there was IMHO a bad case of "creeping featuritis" going around in
the RPG/400 team.  (That was when I was busy with the SAA RPG
compiler.) Initially, the intention for SELECT was something like a
Pascal style case statement or C style switch statement.  In those
statements, you get a fast selection of the alternative, since it's
usually implemented by a simple table lookup.  But functionality won
out over performance considerations.

I suppose the current design of SELECT grates on me since it's not
really the statement it should have been.  On the other hand, if RPG
programmers like it, I shouldn't complain.

(Looking at more recent programming languages like Perl and Python,
the true case or switch statement seems to have fallen out of fashion.)

Cheers!  Hans





This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.