Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Which Should I Use IF/ENDIF or IIF
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00668532
Message ID:
00668571
Views:
13
This message has been marked as a message which has helped to the initial question of the thread.
>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,

As the others have told you, IIF() is faster. The question should be, however, does it make a difference. While I haven't done any testing, I would be surprised if it did with 100+ calls. My guess would be that you'd have to get into the thousands, not 10s of thousands, before any significant difference is realized.

If this is the case, then I'd opt for the existing structure. The reason for this is readability. As it is the code is readable. It becomes less so using IIF().
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform