Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
IIF()
Message
De
28/04/1998 00:19:30
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Re: IIF()
Divers
Thread ID:
00095089
Message ID:
00095299
Vues:
26
Hi George:

Good work on the recent MVP stuff :)



>>Hello,
>> Is an IIF() faster than an If-Else-Endif statement?
>
>As has been stated, yes it is. However, Bret's readability point is an excellent one. Unless conditions exist that make it absolutely necessary (in a loop with a large number of iterations, for example), my feeling is the the speed difference is so minimal, that using the IF/ELSE/ENDIF block is the way to go.
>
>Personally, I tend to use IIF() only in reports and in queries.

I'm an IIF() junkie. I never nest them (which would be REALLY unreadable) but I like to use them in simple, logical settings where the traditional IF..ENDIF is almost a waste of codespace....for example:

I'd much rather use:

nCurrentRecord=IIF(EOF('table'),0,RECNO('table'))

Than:

IF EOF('table')
nCurrentRecord = 0
ELSE
nCurrentRecord = RECNO('table')
ENDIF

It just feels right :)
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform