Kurt,
You are correct.
Some of us were taught various techniques and logic to assist with the
readability and performance of the type coding that was around in RPG II and
III.
Dennis was referring to the technique of always testing to the positive
where possible.
I.e.
IF Rules Satisfied;
MYFLAG = *ON;
ELSE;
MYFLAG = *OFF;
ENDIF;
IF MYFLAG = *ON;
DO SOMETHING;
ELSE;
DO OTHERTHING;
ENDIF;
As opposed to:
IF MYFLAG <> *ON;
DO OTHERTHING;
ELSE;
DO SOMETHING;
ENDIF;
Norm Dennis
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Kurt Anderson
Sent: Friday, 15 January 2010 12:16 AM
To: 'RPG programming on the IBM i / System i'
Subject: Double Negative was RE: rpg style question
For the record, testing for "not equals" is not a double negative. That
would be something like "not not equals" (does that even compile?) The
phrase double negative implies redundancy, which David's "if" statement
doesn't have.
Personally, the way I structure my conditions is so the first true result is
expected to be the most common result of the condition.
-Kurt
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Dennis Lovelady
IF MyFlag <> gYES;
My first comment is that double negatives (if something not equal yes then..
else..) drive me up a wall. Maybe it's just me, but at a minimum the cases
should be reversed. If = no then ... else ...
As an Amazon Associate we earn from qualifying purchases.