Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
IIF()
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Re: IIF()
Divers
Thread ID:
00095089
Message ID:
00095635
Vues:
21
>What's goin' on "Gonzo" John :-)?
>
>>Hi George:
>>
>>Good work on the recent MVP stuff :)
>>
>
>Thanks, but Mark McCasland started it, by bringing it to our attention. And of course, all the other UTers who submitted his name. I'm just happy it worked out as well as it did.
>
>>
>>
>>>>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 :)
>
>I recently had to convert a series of reports which had embedded IIF() statements. I had to break them down into the traditional blocks, otherwise, I never would have understood what was going on.
>
>Anyway, to each his own. With my background (which includes Pascal) it feels exactly the opposite. I will agree, however, that a well spaced in-line IF isn't that much more difficult to read, as long as the expression being evaluted is clearly understood, as well as the results.

lcWinner = IIF("Red Sox" <> ("White Sox" OR "Cubs"), "Pennant", "Cellar")
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform