Examples Delphi

Title: Replacement for the C ternary conditional operator "?"
Question: Replacement for the C ternary conditional operator "?"
Answer:
Original functions by Project JEDI Code Library (JCL).
It's better(read faster) than use Variant Type.
Ps.: Portuguese comments.
//*******************************************************
// Declarao
// Substituio do operador "?" em C
//*******************************************************
function Iff(const Condition: Boolean; const TruePart, FalsePart: Boolean ): Boolean; overload;
function Iff(const Condition: Boolean; const TruePart, FalsePart: Byte ): Byte; overload;
function Iff(const Condition: Boolean; const TruePart, FalsePart: Cardinal): Cardinal; overload;
function Iff(const Condition: Boolean; const TruePart, FalsePart: Char ): Char; overload;
function Iff(const Condition: Boolean; const TruePart, FalsePart: Extended): Extended; overload;
function Iff(const Condition: Boolean; const TruePart, FalsePart: Integer ): Integer; overload;
function Iff(const Condition: Boolean; const TruePart, FalsePart: Pointer ): Pointer; overload;
function Iff(const Condition: Boolean; const TruePart, FalsePart: String ): String; overload;
{$IFDEF SUPPORTS_INT64}
function Iff(const Condition: Boolean; const TruePart, FalsePart: Int64 ): Int64; overload;
{$ENDIF SUPPORTS_INT64}
//*******************************************************
// Funes
// Substituio do operador "?" em C
//*******************************************************
function Iff(const Condition: Boolean; const TruePart, FalsePart: Boolean): Boolean; overload;
begin
if Condition then Result := TruePart
else Result := FalsePart;
end;
//*******************************************************
function Iff(const Condition: Boolean; const TruePart, FalsePart: Byte): Byte; overload;
begin
if Condition then Result := TruePart
else Result := FalsePart;
end;
//*******************************************************
function Iff(const Condition: Boolean; const TruePart, FalsePart: Cardinal): Cardinal; overload;
begin
if Condition then Result := TruePart
else Result := FalsePart;
end;
//*******************************************************
function Iff(const Condition: Boolean; const TruePart, FalsePart: Char): Char; overload;
begin
if Condition then Result := TruePart
else Result := FalsePart;
end;
//*******************************************************
function Iff(const Condition: Boolean; const TruePart, FalsePart: Extended): Extended; overload;
begin
if Condition then Result := TruePart
else Result := FalsePart;
end;
//*******************************************************
function Iff(const Condition: Boolean; const TruePart, FalsePart: Integer): Integer; overload;
begin
if Condition then Result := TruePart
else Result := FalsePart;
end;
//*******************************************************
function Iff(const Condition: Boolean; const TruePart, FalsePart: Pointer): Pointer; overload;
begin
if Condition then Result := TruePart
else Result := FalsePart;
end;
//*******************************************************
function Iff(const Condition: Boolean; const TruePart, FalsePart: String): String; overload;
begin
if Condition then Result := TruePart
else Result := FalsePart;
end;
//*******************************************************
{$IFDEF SUPPORTS_INT64}
function Iff(const Condition: Boolean; const TruePart, FalsePart: Int64): Int64; overload;
begin
if Condition then Result := TruePart
else Result := FalsePart;
end;
{$ENDIF SUPPORTS_INT64}