× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



> From: AGlauser@xxxxxxxxxxxx
> 
> Joe,
> 
> I'm interested in your reasons for using select/when over if/elseif.  I
> think I prefer if/elseif only because I learned about them first, and to
> me case-like statements should fall through like they do in C.  It seems
> redundant to me to have both structures behave identically, and awkward to
> have to do:

I like the semantics of "When this, do this" rather than "if this, do this,
else if this, do this".  I understand your point about the difference
between the C switch and the RPG select because I also learned switch a long
time ago, but frankly the C switch statement leaves a lot to be desired, and
accidentally forgetting a break has caused no end of debugging problems (not
to mention reading "clever" programs where things fall through and different
options share some code).

I would like enhancements to the SELECT, such as being able to do something
if the first condition is met, but then be able to do something if it is NOT
met, and then test other conditions.  For example, read one record and if it
has a certain value, do something.  Otherwise, read a different record and
then do one of three things based on a field in that record.  Of course I
can do it with IF/ELSE/ENDIF, but it's just not as neat, especially as the
indenting creeps in.

Joe



As an Amazon Associate we earn from qualifying purchases.

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-2024 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.