Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
To iif or not to iif = .t.
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00513276
Message ID:
00514367
Views:
11
Jim,

Whoops, pressend Send rather than preview, lets try again.
>I will pay the price when necessary because my personal preferences are (as regards this):
>1) readable code;

I'm fond of saying, "If it ain't readable, it ain't maintainable". Let me suggest that doing away with LOOP and EXIT can make code more readable. Consider the following:
DO WHILE   DO WHILE 
  * Some code here             *Some code here
  IF   IF NOT 
    LOOP && or Exit             * This shows the logical subordination
  ENDIF                         * of the code to the left
  * This is logically          ENDIF
  * sub-ordinate to the
  * logical NOT of the above
ENDDO                        ENDDO
I while this is a very simple sample, even so the code on the right is more readable to me than that on the right.

>2) code that does not 'force' a condition (counter beyond value or condition now obviated) WITHIN A STRUCTURE (this is a problem in waiting);

I'm not sure what you mean here. In some cases with Fox we have to simulate things we don't have. The post-test iteration structure for example. I'm not sure what you mean by "force". Testing for logical NOT, to me, isn't "forcing".

>3) code that does not continue to process the loop condition when it is no longer necessary (IF condition(s) detects nothing more required so they do nothing but allow the natural loop to complete). This is just wasteful.

True, and that's why iteration structures shoulld be properly terminated. With FOR...ENDFOR it mean means that the number of iterations are fixed and should not be subject to change. If the loop needs to conditionally terminate, then DO WHILE...ENDDO is required. Naturally, as I said to Nadya, there are exceptions, but it's important to program to the rules and handle the exceptions rather than the other way around.

>Your preferences are what they are and mine are too. They both end up with working programs.

Yes, I have preferences. However, I'm also keenly aware of the rules regarding programming technique. I don't consider these as such. They exist for a purpose, and in my experience and in my situation they do what they claim to do.
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform