ibec_IIF

Tests a condition and returns Value1 if the Condition is True and Value2 if the Condition is False.

Syntax

  function ibec_IIF(Condition : Boolean; Value1, Value2 : variant): variant;

Description

Tests a condition and returns Value1 if the Condition is True and Value2 if the Condition is False.

Example

  execute IBEBlock
  returns (cout varchar(100))
  as
  begin
    i = 1;
    while (I < 50) do
    begin
      cout = ibec_IIF((ibec_mod(i, 2) = 0), i || ' is even number', i || ' is odd number');
      suspend;
      i = i + 1;
    end
  end

The evaluation of input expressions stops as soon as the result of the entire expression becomes evident in left to right order of evaluation.

See also:
IIF
Firebird 2.0.4. Release Notes: IIF expression syntax added

back to top of page
<< | IBEBlock | >>