IIF

A boolean condition or value is passed into the first argument.

If the condition is true the second argument is evaluated and returned, if false the third argument is evaluated and returned.

Method Signature

IIF(condition=[boolean], expression1=[string], expression2=[string])

Arguments

Argument
Type
Required
Description
Default

condition

boolean

true

The condition to evaluate

expression1

string

true

The expression to evaluate if the condition is true

expression2

string

true

The expression to evaluate if the condition is false

Examples

Simple iIf Example

Run Example

iIf( server.OS.NAME == "Bacon", de( "Running Bacon OS" ), de( "Not Running Bacon OS" ) );

Result: Not Running Bacon OS

Simple Example using Ternary Operator Instead

Instead of using iif, you should use the ternary operator

Run Example

((server.OS.NAME == "Bacon") ? "Running Bacon OS" : "Not Running Bacon OS");

Result: Not Running Bacon OS

Last updated

Was this helpful?