Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Hate Nested IFs? Consider this...
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows 2000 SP4
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01086217
Message ID:
01086320
Views:
12
The point of my example was I need ALL the CASE statements to execute unless the last one failed. At which point I handle the failure, errors, etc. The same thing happens with a bunch of nested IFs, they keep executing until (if) one of them fails. It was also not intended to be an example where someone can point out the obvious of sticking them all on one line of code in an IF or ICASE statement. I just simplified the code for readability.

>David;
>
>Everyone likes to do things for one reason or another. I agree with your approach for readability. It would seem that your code would also be faster as you are executing one line of code as opposed to having to fall through CASE or IF statements.
>
>Tom
>
>P.S. I am a speed freak when it comes to code and data! :)
>
>>no nesting or NOTs needed
>>
>>
>>llSuccess = 1st_Logical_Test and 2nd_Logical_Test and 3rd_Logical_Test
>>
>>
>>which I think is much clearer code to indicate overall success is dependent on each individual test being .t.
Mark McCasland
Midlothian, TX USA
Previous
Reply
Map
View

Click here to load this message in the networking platform