|
Rory, Point taken, but I'd typically use something like the following, simply because that's what I'm used to. Given sufficient exposure, the 1-line method would surely become more familiar, but for me it still isn't as unambiguously clear as an 'if' or a 'select' statement would be. namedIndicator = *off; /default value/ if var1 = var2; namedIndicator = *on; endif; UhhOhhh, you just mentioned 'SEU' - that's likely to bring a whole 'nother series of replies to this post <grin> JK
John, When you say "I always ask myself whether saving a few lines of code with a cute trick is "worth it".", are you saying that you prefer this: if var1 = var2; namedIndicator = *on; else; namedIndicator = *off; endif; over this: namedIndicator = (var1 = var2); In general I agree that understandable maintainable code is better than obscure code. But in this case (and especially if there are multiple of these if-else groups) the removal of 4 lines of code per evaluation is worth it (in my mind) simply because it will tend to make the entire code smaller and more readable. With just 4 of the 5-line evaluations, you've pretty much filled an SEU screen and all you've done is set 4 variables... Rory On 12/13/06, johnking@xxxxxxx <johnking@xxxxxxx> wrote:All, 1) I don't like expressions that require me to stop and think about what they are doing. Perhaps it is because I was not raised on 'C', but a quick glance at a statement like "namedIndicator = (var1 = var2);" just isn't intuitive. RPG has abandoned many of its old abbreviations and shortcuts (like conditioning and resulting indicators) for the sake of readability, so why begin using obscure techniques from other languages? I always ask myself whether saving a few lines of code with a cute trick is "worth it".
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.