Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
IIF vs. IF
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
IIF vs. IF
Divers
Thread ID:
00673310
Message ID:
00673310
Vues:
51
I was wondering, in terms of 1)Speed and 2)Good Form...which is preferable.

lntemp = iif(switch==.t., lntemp+1, lntemp)

OR

if switch == .t.
lntemp = lntemp + 1
endif


Obviously, its nice to have just one line, thus the appeal of the iif. But it seem redundant to continually assign lntemp to itself, especially if the majority of the time 'switch ==.f.' Or is the compiler smart enough not to reassign a variable to itself?

For Example:
lntemp = 1
* a trillion lines of...
lntemp = lntemp

i mean, assuming it takes only 1ns to assign a variable, that's either 1ns or ~17minutes
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform