IIf Function

Syntax:

IIf(condexpr, TruePart, FalsePart)

Group:

Miscellaneous

Description:

Return the value of the parameter indicated by condexpr. Both TruePart and FalsePart are evaluated.

 

Parameter

Description

condexpr

If this value is True then return TruePart. Otherwise, return FalsePart.

TruePart

Return this value if condexpr is True.

FalsePart

Return this value if condexpr is False.

 

See Also:

If, Select Case, Choose( ).

Example:


Sub Main
  Debug.Print IIf(1 > 0,"True","False") '"True"
End
Sub