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




-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Craig Richards
Sent: Saturday, January 26, 2019 10:00 AM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: select vs. if-elseif

Interesting that a few folks apply SELECT or IF / ELSEIF for different
situations.

Personally I pretty much see them as identical and confess I probably use
them fairly randomly.

One technique I have used a fair bit is to utilise sub-procedures that
return booleans so that I can perform more complex checks but still return
FALSE and drop down to the next boolean test in the SELECT or IF / ELSEIF
structure.


I do the same thing:

Select;
When ( process1() };
handleError( #PROCESS1 );
When ( process2() )
handleError ( #PROCESS2 );

etc.

EndSl

process1() returns '0' on success (just so the code is a little cleaner)
We eventually find an error or run out of processes.

We all have our own standards, I make constants all upper case, and
prefix with a pound.
I've never used Else-If, just find Select to be a little more readable.

Chris
www.brilligware.com
Home of MineSweeper5250

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.