?: - Selection of one of two values |
Top Previous Next |
<result> := (<condition> ? <value1> : <value2> ) <condition>
An expression checked with the Empty() function to select either <value1> or <value2> as return value.
<value1>
The value to return if the value of <condition> is not empty.
<value2>
The value to return if the value of <condition> is empty. A call to the Xbase++ function IIf in which <condition> is checked with the Empty function and passed as first parameter. In case the value of <condition> is empty, <value2> is returned, otherwise <value1> is returned. The ?: macro is resolved by a call to the IIf function. It is provided to facilitate porting of C code. The C function is very much like the Xbase++ IIf function, but it is based on a numeric condition value. If <condition> is not equal to zero, <value1> is returned, otherwise <value2>. This behavior is reproduced by applying the Empty function and inverting the result by swapping the values to return. The ?: macro will work for any data type of <condition>. For logicals it behaves like Xbase++ IIf and for numerics it behaves like the C ?: operation. Core Library: cckptcor.lib / cckptcor.dll Header: cmacros.ch
|