Conditionally returns one of two specified values.UnitMathStrUtilsor Categorymiscellaneous routinesDelphi syntax: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; function IfThen(AValue: Boolean; const ATrue: string; const AFalse: string = ''): string; overload;DescriptionIfThen 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.
功能 返回指定的逻辑字符串
说明 IfThen(True, '是', '否') = '是';IfThen(False, '是', '否') = '否'
参考 <NULL>
例子 Edit3.Text := IfThen(CheckBox1.Checked, Edit1.Text, Edit2.Text);
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;
function IfThen(AValue: Boolean; const ATrue: string; const AFalse: string = ''): string; overload;DescriptionIfThen 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.