Derives a return value based on a conditional expression.
function iif( ATest: Boolean; const ATrue: Boolean; const AFalse: Boolean ): Boolean; overload;
Parameters |
Description |
ATest |
Conditional expression to be tested. |
ATrue |
Value to return when the expression is True. |
AFalse |
Value to return when the expression is False. |
Boolean - Return value for the evaluated conditional expression.
iif is a utility function that emulates the ternary operator found in C, C++, C#, and Java.
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.
sResult := iif(bCondition, 'True', 'False'); iResult := iif(bCondition, 1, 0); bResult := iif(bCondition, True, False);
Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
|
Post feedback to the Indy Docs Newsgroup.
|