Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Please explain 'DO WHILE .T.'
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00307982
Message ID:
00307987
Vues:
26
>Relative newbie question....
>
>I'm supporting a VFP6 app written by a developer who was familiar with FPW 2.6 and never really took the time to get up to speed on VFP6. In several places, he uses the DO WHILE .T. .... ENDDO construct.
>
>Hacker's Guide describes it as being a poor programming practice, but doesn't explain the logic. Help has an example in the DO WHILE article, but doesn't explain what is being tested for a .T. condition.
>
>My problem is in thinking through the logic. What is the condition being evaluated, and when does it evaluate to .T. or .F.?
>
>Can someone please enlighten me?
>
>Thanks and Merry Christmas.....
>
Neil,

DO WHILE .T. is a poor practice because .T. will never equal NOT .T. It sets up an infinite loop, and requires that somewhere in the code EXIT must appear to get out of the loop. Much better would be something like:
lldone = < some logical condition >
DO WHILE NOT lldone
  * Code here
  lldone = < some logical condition to terminate the loop >
ENDDO
hth,
George

Ubi caritas et amor, deus ibi est
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform