Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Hate Nested IFs? Consider this...
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Hate Nested IFs? Consider this...
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows 2000 SP4
Database:
Visual FoxPro
Divers
Thread ID:
01086217
Message ID:
01086217
Vues:
67
Jim,

I took this from your comments in the GLGDW thread...

>Some people hate (with a capital H) nesting of IFs simply because they can't stand the indenting. I don't worry about how much indenting is done.

Here is a tip as an alternate to nested IFs that I use just because it is easier for ME to follow:
local llSuccess
llSuccess = .T.
DO CASE
   CASE NOT 1st_Logical_Test
       llSuccess = .F.
   CASE NOT 2nd_Logical_Test
       llSuccess = .F.
   CASE NOT 3rd_Logical_Test
       llSuccess = .F.
   OTHERWISE
       llSuccess = .T.
ENDCASE
RETURN llSuccess
Just remove the "llSuccess = .F." lines above or the "OTHERWISE" clause depending on your preference. That DO CASE is the same as --
LOCAL llSuccess
llSuccess = .F.
IF 1st_Logical_Test
   IF 2nd_Logical_Test
      IF 3rd_Logical_Test
         llSuccess = .T.
      ENDIF
   ENDIF
ENDIF
RETURN llSuccess
Mark McCasland
Midlothian, TX USA
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform