RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
Math.IfThen Function

Conditionally returns one of two specified values.

Pascal
function IfThen(AValue: Boolean; const ATrue: Integer; const AFalse: Integer = 0): Integer; overload;
function IfThen(AValue: Boolean; const ATrue: Int64; const AFalse: Int64 = 0): Int64; overload;
function IfThen(AValue: Boolean; const ATrue: Double; const AFalse: Double = 0.0): Double; overload;
C++
int IfThen(Boolean AValue, const int ATrue, const int AFalse = 0);
Int64 IfThen(Boolean AValue, const Int64 ATrue, const Int64 AFalse = 0);
Double IfThen(Boolean AValue, const Double ATrue, const Double AFalse = 0.0);

IfThen checks the expression passed as AValue and returns ATrue if it evaluates to true, or AFalse if it evaluates to false. In Delphi, if the AFalse parameter is omitted, IfThen returns 0 or an empty string when AValue evaluates to False. 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!