Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
IF command - order of items - results
Message
De
09/06/2011 15:02:27
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01513802
Message ID:
01513880
Vues:
55
>>Unlike some other languages, VFP always perform logical operations in the order they are listed. However, if seek will not find anything, you may be on EOF() or wrong record.
>
>I will go ahead and break the IF command up into two IF commands....
>
>
>IF (Thisform.m_seek(lcFullerRx,"rx_claim","fullerx",1)) AND (rx_claim.statuscode = 2) AND (rx_claim.n_103_a3 = "B1")
>
>
>.......
>
>
>IF (Thisform.m_seek(lcFullerRx,"rx_claim","fullerx",1))
>     IF (rx_claim.statuscode = 2) AND (rx_claim.n_103_a3 = "B1")
>
>blah blah
>
>    ENDIF
>ENDIF
>
I agree 100%, relying on left to right execution order is IMO a bad habit and can cause subtle bugs and maintenance issues later even in languages that nominally follow LTR.

ISTR a thread a while back, might have been started by a Dutchman ( Peter de Valenca or Walter Meester? ) who discovered that LTR is NOT always followed in the SQL engine e.g. in the WHERE clause of a SELECT.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform