JCL Help:Iff@Boolean@Boolean@Boolean

From Project JEDI Wiki
Jump to navigationJump to search


Summary

Replacement for the C++ ternary conditional operator.


Pascal

 function Iff(const Condition: Boolean; const TruePart: string; const FalsePart: string): string; overload;
function Iff(const Condition: Boolean; const TruePart: Char; const FalsePart: Char): Char; overload;
function Iff(const Condition: Boolean; const TruePart: Byte; const FalsePart: Byte): Byte; overload;
function Iff(const Condition: Boolean; const TruePart: Integer; const FalsePart: Integer): Integer; overload;
function Iff(const Condition: Boolean; const TruePart: Cardinal; const FalsePart: Cardinal): Cardinal; overload;
function Iff(const Condition: Boolean; const TruePart: Float; const FalsePart: Float): Float; overload;
function Iff(const Condition: Boolean; const TruePart: Boolean; const FalsePart: Boolean): Boolean; overload;
function Iff(const Condition: Boolean; const TruePart: Pointer; const FalsePart: Pointer): Pointer; overload;
function Iff(const Condition: Boolean; const TruePart: Int64; const FalsePart: Int64): Int64; overload;
function Iff(const Condition: Boolean; const TruePart: Variant; const FalsePart: Variant): Variant; overload;


Parameters

Parameters Description
const Condition: Boolean The expression which determines which of the other parameters is returned as the function result.
const TruePart: string The function result if Condition evaluates to True.
const FalsePart: string The function result if Condition evaluates to False.


Return Value

If Condition evaluates to True TruePart is returned, otherwise FalsePart is returned.


Description

Iff is a replacement for the C/C++ ternary conditional operator ?:. It evaluates the specified boolean expression and depending on the outcome returns either the specified TruePart or FalsePart parameter. The difference to the C/C++ operator is that both expressions are evaluated.


About

Unit

JclSysUtils


Donator

Bernhard Berger


Contribute to this help topic

This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page