|
Interesting point. I guess I just got used to the Select and haven't gone back. Rob Berendt -- Group Dekko Services, LLC Dept 01.073 PO Box 2000 Dock 108 6928N 400E Kendallville, IN 46755 http://www.dekko.com Michael Jacobsen <MJacobsen@xxxxxxxxxxxxxxxx> Sent by: rpg400-l-bounces@xxxxxxxxxxxx 12/30/2004 08:41 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 > Here is an example of when I would use select over an If/Else With the > Select you don't have all the endif's & I think it is easier to > understand. I just wanted to clarify that with If/ElseIf you don't need "all the endif's". When the opcode ELSEIF was added in V5R1 I believe, it eliminated the need to code multiple EndIf's. Ex: Exfmt Screen If KeyPressed = Enter do something ElseIf KeyPressed = F3 exit from program ElseIf Keypressed = F12 Backup EndIf The above does the same as a select/when only is 1 line shorter because there is no Select statement at the beginning. And adding a ELSE at the end would work the same as OTHER. But I agree with Jon Paris on when to use what. For the above example, I would probably use a Select instead since the same field is being tested for different values. Mike Mike -- 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.
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.