Home > lang > iif 
 en fr de es it nl pl pt pt_BR mk sq ca hu cs tr ar fa id vi ja ru zh zh_TW eo
Previous  Next  Edit  Rename  Undo  Search  Administration  
Documentation  
Warning! This page is not translated.  See english version 
IIf
Value = IIf ( Test AS Boolean , TrueExpression , FalseExpression )
Value = If ( Test AS Boolean , TrueExpression , FalseExpression )

Evaluate the Test expression, and return TrueExpression if this expression is TRUE, or FalseExpression if this expression is FALSE.

BE CAREFUL!

Contrary to IF, or the C/Perl ? operator, both TrueExpression and FalseExpression are evaluated, whatever the value of Test is.

Example

X = 7
PRINT If((X MOD 2) = 0, "even", "odd")

odd

' Never do the following in real code, because it is not translatable!
X = 7
PRINT "You have " & X & " message" & If(X <> 1, "s", "") & " waiting."

You have 7 messages waiting.

PRINT If((X MOD 2) = 1, "odd", 1 / 0)

Division by zero

See also

Test Control Structures & Functions