|
What is the advantage over: C dou cmd3 or cmd12 .... select when cmd3 exsr endpgm when cmd12
no particular advantage except personal preference and style. I don't like compound and complicated if / do statements. the simpler the better. If I add another function that leaves the loop, I have to make the do line even more complex. In the example i gave, only F3 and F12 exit the loop. But in another program I might have another 6 command keys or other conditions who's functionality requires that I leave the loop. That would make my dow look a mess. Why complicate the dow requirements when I can simply put the leave or iter right next to the "when" clause that processes it? If I'm looking at what F17 processing does, and that particular "when" section ends with another when, I don't have to page up the top of the do to check if that condition ends the loop or not - it's right there in front of me, no need to look at the loop. There also might be code after the endsl that gets processed for several of the when groups, but none of the iter/leave when groups. again, it's just personal preference. imo, smoother, easier to understand, no jumping around looking for what happens next. if it "leaves", I find the enddo. if it "iters" I go to up to the do. and again, I rarely use this technique outside of my screen processing subroutines. I can take my skeleton and create a simple subfile pgm in an hour, and this technique allows me to add complexity to it very quickly, without changing the basic structure. they all look the same and work the same.
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.