Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
IF...ENDIF, IIF
Message
 
 
To
21/07/2009 10:34:21
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01413551
Message ID:
01413555
Views:
99
>I'm sure that this has already been covered.
>
>Any real benefits to use iif instead of if...else...endif?

IIF() is a function and IF is a statement. They are not always interchangeable. I would use IIF() when condition is simple and easily can be replaced with IIF(). It's more readable for me. For example
IF a=b
  c=3
ELSE
  c=4
ENDIF

* Replacement
c = IIF(a=b, 3, 4)
Also following IF I've seen many times can be simplified w/o using IIF()
IF a=b
  llSomething = .T.
ELSE
  llSomething = .F.
ENDIF

* Replacement
llSomething = (a=b)
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform