Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
To iif or not to iif = .t.
Message
 
 
To
31/05/2001 14:42:48
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00513276
Message ID:
00513349
Views:
13
>>Well, if it's a pet peeve, I can assure you that you're not alone. < Puts on fire suit against the upcoming flames > One thing that I think Foxheads don't handle as well as programmers in some other languages, or at least it used to be so, is the handling of Boolean values. My biggest peeve is the something like the following:
DO WHILE .T.
>>  * Bunch of code here
>>  * Leading to...
>>  IF llcondition
>>    EXIT
>>  ENDIF
>>ENDDO
rather than
>>llcondition = .F.
>>DO WHILE NOT llcondition
>>  * Bunch of code here
>>  * Including a statement like
>>  llcondition = < Logical Expression >
>>ENDDO
Of course, this is just IMO, so I could be wrong.:-)
>
>I agree entirely. I consider EXIT and LOOP to be bugs until proven otherwise :-) Almost without exception, it's an indication that the coder hasn't thought the logic through clearly, making the entire structure suspect.
>
>Personally, I also consider an IF statement without an ELSE in the same class.

Hi Al,

What can you do in this situation:
on escape ovalid.DoExit() && this would set oValid.lContinue to .f. it user wants to exit
do while oValid.lContinue
  for i=1 to lnEnd
      ......
      for i=1 to lnEnd2
        ...
        scan 
        endscan
      next
   next
enddo
I had to put exit in each loop in if endif...
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform