Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
IF...ENDIF, IIF
Message
 
 
À
21/07/2009 10:34:21
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
01413551
Message ID:
01413555
Vues:
98
>I'm sure that this has already been covered.
>
>Any real benefits to use iif instead of if...else...endif?

IIF() is a function and IF is a statement. They are not always interchangeable. I would use IIF() when condition is simple and easily can be replaced with IIF(). It's more readable for me. For example
IF a=b
  c=3
ELSE
  c=4
ENDIF

* Replacement
c = IIF(a=b, 3, 4)
Also following IF I've seen many times can be simplified w/o using IIF()
IF a=b
  llSomething = .T.
ELSE
  llSomething = .F.
ENDIF

* Replacement
llSomething = (a=b)
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform