Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
IIF vs. IF
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
IIF vs. IF
Miscellaneous
Thread ID:
00673310
Message ID:
00673310
Views:
52
I was wondering, in terms of 1)Speed and 2)Good Form...which is preferable.

lntemp = iif(switch==.t., lntemp+1, lntemp)

OR

if switch == .t.
lntemp = lntemp + 1
endif


Obviously, its nice to have just one line, thus the appeal of the iif. But it seem redundant to continually assign lntemp to itself, especially if the majority of the time 'switch ==.f.' Or is the compiler smart enough not to reassign a variable to itself?

For Example:
lntemp = 1
* a trillion lines of...
lntemp = lntemp

i mean, assuming it takes only 1ns to assign a variable, that's either 1ns or ~17minutes
Next
Reply
Map
View

Click here to load this message in the networking platform