Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Single exit-point
Message
De
03/04/2002 10:45:12
 
 
À
03/04/2002 10:01:20
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00640316
Message ID:
00640370
Vues:
19
Hello Hilmar,

In Code Complete, Steve McConnell covers issues like this (and many more). If I remember correctly, the strategy you proposed is shown in his book, along with nesting, like below. He proposes a solution like yours when the number of steps makes nesting unmanageable.

I highly recommend the book...

>
>Next question. Let's say I want to follow this principle (in general, or in one specific method - doesn't matter for this question). If something goes wrong, I have to interrupt. Is there an easier way to do this than maintaining a variable, as in the following sample pseudocode?
>
local llSuccess
llContinue = .T.
(Do Something)
if (checkCondition1)
   (do phase 2)
   if (checkCondition2)
      (do phase 3)
   else
      ErrorMessage("Problem 2")
      llSuccess = .f.
   endif
else
   ErrorMessage("Problem 1")
  llSuccess = .f.
endif

(Cleanup)
RETURN && or RETURN llSuccess, to signal success
Steve Gibson
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform