|
Assuming that the EitherWay clause was implemented like this, where there could be multiple EitherWay clauses and each of them could be limited to a subset of the When clauses, I like it. It is much less confusing than my MultiSelect idea. And it could handle all of the cases I can think of off hand where I would want to use the MultiSelect idea. I also find it much more appealing than the current options. A potential problem I see is that because the When clauses are not limited to all testing the same expression, the order they are specified in is often important and it would not always be possible to write the Select statement so that the EitherWay statement could simply check if any of the previous when clauses where true. To overcome this you would need to be able to tell the EitherWay clause which of the When clauses to check. Joe Lee >>> rob@xxxxxxxxx 12/30/2004 10:56:38 >>> Perhaps a better example is: Select; When A=5; // take action When A=7; // take different action When A=8; // take different action Either way; Except detail; When A=6; // take 6 unique action When A=9; // take 9 unique action Either way; Except Hark; EndSL; Rob Berendt -- Group Dekko Services, LLC Dept 01.073 PO Box 2000 Dock 108 6928N 400E Kendallville, IN 46755 http://www.dekko.com Tony Carolla <carolla@xxxxxxxxx> Sent by: rpg400-l-bounces@xxxxxxxxxxxx 12/30/2004 11:18 AM Please respond to RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> To RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> cc Subject Re: Select/When vs. If/ElseIf 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 >
As an Amazon Associate we earn from qualifying purchases.
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.