Delphi Programming RTL Reference|By Category|Alphabetically|By Unit
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;
Returns one of two values, depending on the evaluation of an expression.
var i,j : integer;
s:string;
i:= 2003; j:= 1973;
s:='abba';
(* fist example *)
IfThen(i > j, i-j, j-1) //results in 2003-1973 = 30
(* second example *)
IfThen(s = ReverseString(s),s + ' equals its reverse order!', 'NO')
//returns 'abba equals its reverse order'
|
String Types in Delphi
Understanding and managing string data types in Delphi's Object Pascal. Learn about differences between Short, Long, Wide and null-terminated strings.
ReverseString,
|
Free Delphi code snippet inside every Delphi Newsletter! |
|
|
|
Got some code to share? Got a question? Need some help? |
|
|