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