Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Single exit-point
Message
From
03/04/2002 10:45:12
 
 
To
03/04/2002 10:01:20
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00640316
Message ID:
00640370
Views:
18
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
Previous
Reply
Map
View

Click here to load this message in the networking platform