Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Which Should I Use IF/ENDIF or IIF
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00668532
Message ID:
00668657
Vues:
16
Sergey;

I think all code should be contained on one line - it runs faster. My goal is to write a complete application on one row. Think of the speed! :)

In real life I will normally use structured code for readability and sometimes IIF statements when needed. Some IIF statements can be complex to understand.

Tom


>IMO, the code with IIF() would be more readable because it would be more compact.
ldStartOn = ldStartOn + IIF( VARTYPE(ldStartOn)=[D], 1, 86400)
>
>
>>I have a fairly large module that contains a search routine that consists of a series of Loops inside loops, inside loops. Within the loops I have serveral places where I do comparisons such as:
>>
>>
>>IF VARTYPE(ldStartOn)=[D]
>>    ldStartOn=ldStartOn+1
>>ELSE
>>    ldStartOn=ldStartOn+86400
>>ENDIF
>>
>>
>>I like the code format for readability of the IF/ELSE/ENDIF, but I'm wondering if I'm doing myself a disservice in terms of speed. This code could be replaced with a IIF(). Since this module I'm looking at runs potientially 100+ times before it exits, I thought I might want to find out which way was better in terms of speed.
>>
>>Thanks for any input.
>>
>>Kirk
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform