Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
IIF vs. IF
Message
De
28/06/2002 11:22:46
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00673310
Message ID:
00673313
Vues:
13
I often replace IF with IIF. I don't think the time difference will be significant, but I do suggest, as a general norm, to reduce redundant code. I am fairly sure the compiler will not optimize this.

Hilmar.

>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
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform