Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
To iif or not to iif = .t.
Message
 
À
31/05/2001 13:15:07
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00513276
Message ID:
00513337
Vues:
13
>Here's a quote from a recent thread:
>
loColumn.DynamicFontBold = "'IIF(THIS.PARENT.gnRecNo = RECNO THIS.PARENT.RecordSource), .T., .F.)'"
>I wouldn't be starting on this if this was the only one, but I'm seeing the IIf({expL}, .T., .F.) just far too often, so I started wondering what made this become customary.
>I've even seen IIF(.T., .F., .F.) in a property (where a string containing a logical expression was expected).
>What I don't understand is why would anyone want to write
>
If DESCENDING()
>	Thisform.lSaveAscending = .F.
>Else
>	Thisform.lSaveAscending = .T.
>Endif
>instead of
>
Thisform.lSaveAscending =NOT DESCENDING()
>Or why is this form
>
llHasValue=iif(empty(lcValueString), .F., .T.)
>preferrable over the
>
llHasValue=not empty(lcValueString)
>Was it a readability issue, or what? I'm still thinking that
>
c=a#b
is more clear and more readable than
>
c=iif(a=b, .f., .t.)
or, worse,
>
if a=b
>   c=.f.
>else
>   c=.t.
>endif
>Is it just my pet peeve, or are there some recommendations about this?

I go for readability before quickness. As with the speed of processors increasing your program will increase in speed, but will never get easier to read.
Bret Hobbs

"We'd have been called juvenile delinquents only our neighborhood couldn't afford a sociologist." Bob Hope
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform