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

This thread ...


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

This mailing list archive is Copyright 1997-2019 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].