Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Huge table and seek/indexseek commands
Message
From
10/08/2002 08:54:02
Walter Meester
HoogkarspelNetherlands
 
 
To
09/08/2002 14:21:08
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00687800
Message ID:
00688287
Views:
55
Hi hilmar,

>OK, here is one "contest": you have to run three functions one after the other. func2() should only run if func1() is successful, and func3(), again, depends on the successful completion of func2(). Do you see an alternative that is shorter than two nested IFs?

That's too easy,
= Func(1) AND Func(2) AND Func(3)
Or if you want a more structured way in handling failures:
DO CASE
   CASE !Func(1)
        ** Handle exception here

   CASE !Func(2)
        ** Handle exception here

   CASE !Func(3)
        ** Handle exception here

   OTHERWISE
        ** All functions succeeded
ENDCASE
Some might argue that the latter is a bad coding practise as the CASE lines cannot be moved from one position to another. OTOH, this practise does help to avoid nested IFs and IMO does produce more readable code.

Walter,
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform