Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CASE statements
Message
From
24/10/2003 17:32:03
 
 
To
24/10/2003 16:55:27
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00838740
Message ID:
00842474
Views:
38
I disagree completely.

>My point is that with the RETURN code you don't explicitly say that the steps are conditional, that they depend on what happened on previous step.

It is quite explicit.
Any average VFP programmer should know that IF expressions are conditionally tested, i.e., are only tested if the previous conditions succeeded. That's why I posted example code.

>They could be not.

No IF statement in VFP with multiple conditions will ever test all conditions if one of them fails. Whether or not the steps should be conditional would have already been determined prior to writing any code.
All formats discussed in this thread (nested ifs, "not cases", and this return) have assumed that the steps are conditional -- to wit,

1. Test a series of conditions
2. As soon as one fails, stop testing conditions.
3. If none fail, move on to the meat of the code.

>And this thread is about it: writing clear code. The clear and most obviuos, the better.

I find this one return and "not cases" extremely clear and obvious. I have not found nested ifs clear and obvious in most situations that I have seen them. I do still prefer "not cases" as I can maintain them better - e.g., if one particular case fails and requires special handling in one caller only (I've seen this more than I thought I ever would), it's easier to add the handler code/call to the case.

>It happens a lot that the smarter programmer is not the best one.

That sounds like a new thread to me :)
Insanity: Doing the same thing over and over and expecting different results.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform