Indy 9 | Content | Index | Reference

iif
Unit: IdGlobal
Returns a value based on a conditional expression.

    function iif(ATest: Boolean; const ATrue: Integer; const AFalse: Integer): Integer; overload;
    function iif(ATest: Boolean; const ATrue: string; const AFalse: string): string; overload;
    function iif(ATest: Boolean; const ATrue: Boolean; const AFalse: Boolean): Boolean; overload;

Unit
IdGlobal
Parameters
ATest: Boolean
Conditional expression to be tested.
const ATrue: Integer
Value to return when the expression is True.
const AFalse: Integer
Value to return when the expression is False.
Return Value
Integer - Return value for the evaluated conditional expression.

String - Return value for the evaluated conditional expression.

BOoelan - Return value for the evaluated conditional expression.

Description
Iif is an overloaded function that provides return values specified in ATrue and AFalse based on the conditional test expression in ATest. When ATest evaluates to True, then the return value in ATrue is used. When ATest evaluates to False, then return value in AFalse is used. Iif is overloaded to allow use of Integer, String, and Boolean return values.

Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.