|
Personally, I use If/Else/EndIf if there are only two possibilities,
and I only use the Else if there is something to do either way. For
all other situations, I use Select/When/Other. If I revise a program,
and there is an If/Else/EndIf that now has another possiblilty, I
replace it with Select/When/Other. I don't make use of the ElseIf
clause.
But this brings up another idea I had. Occasionally, I will encounter
a set of conditions that may or may not be true, and for each
condition, a different action must be taken, but if any one of the
conditions in the set are true, I want to do something in addition to
the different tasks for each one in the set. ex.:
Select;
When A=5;
// take action
Except detail
When A=7;
// take different action
Except detail;
When A=8;
// take different action
Except detail;
EndSL;
In this snippet, I want to print the 'detail' exception format if A=5,
7 or 8, but not otherwise. Wouldn't it be nice to have an 'EitherWay'
op, which was executed if any of the when clauses were true? i.e.
Select;
When A=5;
// take action
When A=7;
// take different action
When A=8;
// take different action
EitherWay;
Except detail;
EndSL;
Wacky idea? What do you think?
On Wed, 29 Dec 2004 16:12:51 -0600, Kurt Anderson
<kjanderson@xxxxxxxxxxxxx> wrote:
> Is there a difference to these two types of condition checking?
> They seem identical in function at a high level, so I'm unsure if one is
> better performance-wise or something. I guess I'm looking for something
> to distinguish the two so I know when to use one and when to use the
> other.
>
> Thanks,
>
> Kurt Anderson
> Application Developer
> Highsmith Inc.
> W5527 State Road 106, P.O. Box 800
> Fort Atkinson, WI 53538-0800
> TEL (920) 563-9571 FAX (920) 563-7395
> EMAIL kjanderson@xxxxxxxxxxxxx
>
> --
> This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
> To post a message email: RPG400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
> or email: RPG400-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.
>
>
--
"Enter any 11-digit prime number to continue..."
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.